hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c3230602dc6ce8125868679fb1c35533fbc07f4 | 264 | py | Python | Exercise-1/Q15_diffNum.py | abhay-lal/18CSC207J-APP | 79a955a99837e6d41c89cb1a9e84eb0230c0fa7b | [
"MIT"
] | null | null | null | Exercise-1/Q15_diffNum.py | abhay-lal/18CSC207J-APP | 79a955a99837e6d41c89cb1a9e84eb0230c0fa7b | [
"MIT"
] | null | null | null | Exercise-1/Q15_diffNum.py | abhay-lal/18CSC207J-APP | 79a955a99837e6d41c89cb1a9e84eb0230c0fa7b | [
"MIT"
] | null | null | null | def check(arr):
for num in arr:
if num in arr[arr.index(num)+1:]:
return False
return True
numbers = list(map(int, input("Enter the numbers: ").split()))
if (check(numbers)):
print("Different")
else:
print("Not Different") | 22 | 62 | 0.590909 | def check(arr):
for num in arr:
if num in arr[arr.index(num)+1:]:
return False
return True
numbers = list(map(int, input("Enter the numbers: ").split()))
if (check(numbers)):
print("Different")
else:
print("Not Different") | true | true |
1c3233bbc704222b68e2f5e756163b08e3d8050e | 1,698 | py | Python | Oblig3/eval_on_test.py | fabiorodp/IN5550_Neural_Methods_in_Natural_Language_Processing | 4d3b2ed56b56e016413ae1544e19ad2a2c0ef047 | [
"MIT"
] | null | null | null | Oblig3/eval_on_test.py | fabiorodp/IN5550_Neural_Methods_in_Natural_Language_Processing | 4d3b2ed56b56e016413ae1544e19ad2a2c0ef047 | [
"MIT"
] | null | null | null | Oblig3/eval_on_test.py | fabiorodp/IN5550_Neural_Methods_in_Natural_Language_Processing | 4d3b2ed56b56e016413ae1544e19ad2a2c0ef047 | [
"MIT"
] | null | null | null | #! python3
# coding: utf-8
from argparse import ArgumentParser
from conllu import parse
from ner_eval import Evaluator
def f1(precision, recall, eps=1e-7):
score = 2 * (precision * recall) / (precision + recall + eps)
return score
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argu... | 28.3 | 80 | 0.617786 |
from argparse import ArgumentParser
from conllu import parse
from ner_eval import Evaluator
def f1(precision, recall, eps=1e-7):
score = 2 * (precision * recall) / (precision + recall + eps)
return score
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument(
"--prediction... | true | true |
1c323454c7cfcd8d98b8fce09c225ab1b6acb53f | 161 | py | Python | main.py | AKSHITA-SRIVASTAVA/PhotoOrganiser | f00490219bd05ff977669f30b88afe708e182d9a | [
"MIT"
] | null | null | null | main.py | AKSHITA-SRIVASTAVA/PhotoOrganiser | f00490219bd05ff977669f30b88afe708e182d9a | [
"MIT"
] | null | null | null | main.py | AKSHITA-SRIVASTAVA/PhotoOrganiser | f00490219bd05ff977669f30b88afe708e182d9a | [
"MIT"
] | null | null | null | import os
cwd = os.getcwd()
os.chdir(cwd+'/images')
cwd = os.getcwd()
file_list = os.listdir(cwd)
for i in range(len(file_list)):
print(file_list[i])
| 11.5 | 31 | 0.652174 | import os
cwd = os.getcwd()
os.chdir(cwd+'/images')
cwd = os.getcwd()
file_list = os.listdir(cwd)
for i in range(len(file_list)):
print(file_list[i])
| true | true |
1c32349232bd3da9067aafed3d454e41f9ef4bee | 7,628 | py | Python | test/core/028-dynamic-hierarchy-b/workflow.py | spxiwh/pegasus | ebe3e205ae34c1721c540465712da557979c7437 | [
"Apache-2.0"
] | null | null | null | test/core/028-dynamic-hierarchy-b/workflow.py | spxiwh/pegasus | ebe3e205ae34c1721c540465712da557979c7437 | [
"Apache-2.0"
] | null | null | null | test/core/028-dynamic-hierarchy-b/workflow.py | spxiwh/pegasus | ebe3e205ae34c1721c540465712da557979c7437 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
import logging
from pathlib import Path
from Pegasus.api import *
logging.basicConfig(level=logging.DEBUG)
TOP_DIR = Path(__file__).resolve().parent
# --- Properties ---------------------------------------------------------------
# properties that will be used by both the outer workflow and ... | 39.937173 | 138 | 0.613529 | import logging
from pathlib import Path
from Pegasus.api import *
logging.basicConfig(level=logging.DEBUG)
TOP_DIR = Path(__file__).resolve().parent
props = Properties()
props["pegasus.dir.storage.deep"] = "false"
props["pegasus.condor.logs.symlink"] = "false"
props["pegasus.data.configuration"] = "condorio"
props[... | true | true |
1c3234ec71ed87182691177575f951332dc73e55 | 26,635 | py | Python | pysystests/app/rest_client_tasks.py | couchbaselabs/testrunner-bharath | 96af90070da2140cc11c549db7403f5ea3b76d34 | [
"Apache-2.0"
] | 1 | 2020-08-31T18:51:45.000Z | 2020-08-31T18:51:45.000Z | pysystests/app/rest_client_tasks.py | couchbaselabs/testrunner-bharath | 96af90070da2140cc11c549db7403f5ea3b76d34 | [
"Apache-2.0"
] | null | null | null | pysystests/app/rest_client_tasks.py | couchbaselabs/testrunner-bharath | 96af90070da2140cc11c549db7403f5ea3b76d34 | [
"Apache-2.0"
] | 2 | 2020-07-24T07:12:01.000Z | 2022-03-17T23:43:28.000Z | ##!/usr/bin/env python
"""
rest tasks
"""
import base64
import sys
sys.path=["../lib"] + sys.path
from membase.api.rest_client import RestConnection
from remote.remote_util import RemoteMachineShellConnection
from couchbase_helper.document import View
from app.celery import celery
import app
import testcfg as cfg
im... | 36.139756 | 180 | 0.602966 |
import base64
import sys
sys.path=["../lib"] + sys.path
from membase.api.rest_client import RestConnection
from remote.remote_util import RemoteMachineShellConnection
from couchbase_helper.document import View
from app.celery import celery
import app
import testcfg as cfg
import json
import time
import random
import e... | true | true |
1c3235090113f2ffd6c9298c078e8540cb1f7cfb | 12,039 | py | Python | retinaface/inference.py | markyong97/retinafacetest | b72317d682c9e17492f5418073073e63c4ce2ce2 | [
"MIT"
] | null | null | null | retinaface/inference.py | markyong97/retinafacetest | b72317d682c9e17492f5418073073e63c4ce2ce2 | [
"MIT"
] | null | null | null | retinaface/inference.py | markyong97/retinafacetest | b72317d682c9e17492f5418073073e63c4ce2ce2 | [
"MIT"
] | null | null | null | import argparse
import json
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
import albumentations as albu
import cv2
import numpy as np
import torch
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
import yaml
from albumentations.core.serializatio... | 35.937313 | 116 | 0.627212 | import argparse
import json
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
import albumentations as albu
import cv2
import numpy as np
import torch
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
import yaml
from albumentations.core.serializatio... | true | true |
1c32366e0506e618798d03ee9041626145d5f87a | 259,512 | py | Python | xarray/tests/test_dataset.py | pentschev/xarray | de6144c0e8c8fc316cfc412a2057af4d1a04edfd | [
"CC-BY-4.0",
"PSF-2.0",
"BSD-2-Clause",
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | xarray/tests/test_dataset.py | pentschev/xarray | de6144c0e8c8fc316cfc412a2057af4d1a04edfd | [
"CC-BY-4.0",
"PSF-2.0",
"BSD-2-Clause",
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | xarray/tests/test_dataset.py | pentschev/xarray | de6144c0e8c8fc316cfc412a2057af4d1a04edfd | [
"CC-BY-4.0",
"PSF-2.0",
"BSD-2-Clause",
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | import pickle
import sys
import warnings
from copy import copy, deepcopy
from io import StringIO
from textwrap import dedent
import numpy as np
import pandas as pd
import pytest
from pandas.core.computation.ops import UndefinedVariableError
from pandas.core.indexes.datetimes import DatetimeIndex
from pandas.tseries.fr... | 36.285235 | 102 | 0.539239 | import pickle
import sys
import warnings
from copy import copy, deepcopy
from io import StringIO
from textwrap import dedent
import numpy as np
import pandas as pd
import pytest
from pandas.core.computation.ops import UndefinedVariableError
from pandas.core.indexes.datetimes import DatetimeIndex
from pandas.tseries.fr... | true | true |
1c32367f3d8a1f38a3cb8556d0680446dbad020c | 6,747 | py | Python | numpy/_pytesttester.py | lgeiger/numpy | be8ab91f789c3b688d707940016b4c2d262913e9 | [
"BSD-3-Clause"
] | 1 | 2020-07-01T03:50:43.000Z | 2020-07-01T03:50:43.000Z | numpy/_pytesttester.py | lgeiger/numpy | be8ab91f789c3b688d707940016b4c2d262913e9 | [
"BSD-3-Clause"
] | 24 | 2021-05-03T11:31:55.000Z | 2021-08-02T11:23:24.000Z | numpy/_pytesttester.py | lgeiger/numpy | be8ab91f789c3b688d707940016b4c2d262913e9 | [
"BSD-3-Clause"
] | 2 | 2021-08-16T05:10:04.000Z | 2022-01-15T09:10:09.000Z | """
Pytest test running.
This module implements the ``test()`` function for NumPy modules. The usual
boiler plate for doing that is to put the following in the module
``__init__.py`` file::
from numpy._pytesttester import PytestTester
test = PytestTester(__name__).test
del PytestTester
Warnings filterin... | 31.381395 | 79 | 0.610345 | import sys
import os
__all__ = ['PytestTester']
def _show_numpy_info():
from numpy.core._multiarray_umath import (
__cpu_features__, __cpu_baseline__, __cpu_dispatch__
)
import numpy as np
print("NumPy version %s" % np.__version__)
relaxed_strides = np.ones((10, 1), order="C").flags.f_c... | true | true |
1c32368041c5844409ff9001a9d04b7307f13cd4 | 2,791 | py | Python | firebase_admin/firestore.py | AFFOA/firebase-admin-python | bf783c313348f4c48f2b8c9bd5df52d617051989 | [
"Apache-2.0"
] | 4 | 2018-02-25T22:18:33.000Z | 2021-02-03T05:00:43.000Z | firebase_admin/firestore.py | AFFOA/firebase-admin-python | bf783c313348f4c48f2b8c9bd5df52d617051989 | [
"Apache-2.0"
] | 1 | 2018-08-15T01:05:59.000Z | 2018-08-15T01:05:59.000Z | firebase_admin/firestore.py | AFFOA/firebase-admin-python | bf783c313348f4c48f2b8c9bd5df52d617051989 | [
"Apache-2.0"
] | 1 | 2019-04-09T06:18:41.000Z | 2019-04-09T06:18:41.000Z | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 36.246753 | 97 | 0.707273 |
try:
from google.cloud import firestore existing = globals().keys()
for key, value in firestore.__dict__.items():
if not key.startswith('_') and key not in existing:
globals()[key] = value
except ImportError:
raise ImportError('Failed to import the Cloud Firestore library for Pytho... | true | true |
1c32372afbcc3b4faf98b67746dbab2cc0047a83 | 11,057 | py | Python | evolution/evaluator.py | vfcosta/coegan-trained | 44174e68909d9c03bf2e4b7e4c7a48237a560183 | [
"MIT"
] | null | null | null | evolution/evaluator.py | vfcosta/coegan-trained | 44174e68909d9c03bf2e4b7e4c7a48237a560183 | [
"MIT"
] | null | null | null | evolution/evaluator.py | vfcosta/coegan-trained | 44174e68909d9c03bf2e4b7e4c7a48237a560183 | [
"MIT"
] | 1 | 2021-06-11T16:52:55.000Z | 2021-06-11T16:52:55.000Z | import util.tools as tools
from util import config
import torch
import logging
import numpy as np
from evolution.population import Population
logger = logging.getLogger(__name__)
class Evaluator:
def __init__(self, train_loader, validation_loader):
self.train_loader = train_loader
self.validatio... | 49.142222 | 138 | 0.600344 | import util.tools as tools
from util import config
import torch
import logging
import numpy as np
from evolution.population import Population
logger = logging.getLogger(__name__)
class Evaluator:
def __init__(self, train_loader, validation_loader):
self.train_loader = train_loader
self.validatio... | true | true |
1c3237e26b246d2c6c4ee775f1496398da1f6b77 | 1,643 | py | Python | ooobuild/lo/ucb/x_content_provider_supplier.py | Amourspirit/ooo_uno_tmpl | 64e0c86fd68f24794acc22d63d8d32ae05dd12b8 | [
"Apache-2.0"
] | null | null | null | ooobuild/lo/ucb/x_content_provider_supplier.py | Amourspirit/ooo_uno_tmpl | 64e0c86fd68f24794acc22d63d8d32ae05dd12b8 | [
"Apache-2.0"
] | null | null | null | ooobuild/lo/ucb/x_content_provider_supplier.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... | 34.957447 | 150 | 0.752891 | import typing
from abc import abstractmethod
from ..uno.x_interface import XInterface as XInterface_8f010a43
if typing.TYPE_CHECKING:
from .x_content_provider import XContentProvider as XContentProvider_d4150cc0
class XContentProviderSupplier(XInterface_8f010a43):
__ooo_ns__: str = 'com.sun.star.ucb'
__ooo... | true | true |
1c323835a274c50d8c2e101b6752aae91a3e1698 | 988 | py | Python | tools/mturk/aws_credentials.py | brendel-group/causal-understanding-via-visualizations | 3cd1a30f4305c48b1a715da5f62a552d803fb933 | [
"MIT"
] | 6 | 2021-06-30T11:10:48.000Z | 2022-01-14T11:36:14.000Z | tools/mturk/aws_credentials.py | brendel-group/causal-understanding-via-visualizations | 3cd1a30f4305c48b1a715da5f62a552d803fb933 | [
"MIT"
] | null | null | null | tools/mturk/aws_credentials.py | brendel-group/causal-understanding-via-visualizations | 3cd1a30f4305c48b1a715da5f62a552d803fb933 | [
"MIT"
] | null | null | null | """Loads the credentials needed to access AWS"""
import os
class AWSCredentials:
"""
Access AWS credentials.
"""
__loaded = False
@staticmethod
def aws_secret_access_key():
AWSCredentials._load_data()
return AWSCredentials.__aws_secret_access_key
@staticmethod
def a... | 25.333333 | 83 | 0.634615 |
import os
class AWSCredentials:
__loaded = False
@staticmethod
def aws_secret_access_key():
AWSCredentials._load_data()
return AWSCredentials.__aws_secret_access_key
@staticmethod
def aws_access_key_id():
AWSCredentials._load_data()
return AWSCredentials.__aws_a... | true | true |
1c3238a93189fc6466b61699e891244a53b23a8e | 484 | py | Python | src/database/addingData.py | inpritamkundu/python | 27e404493cd436106cdf493a81e4f074f5d5ab96 | [
"MIT"
] | null | null | null | src/database/addingData.py | inpritamkundu/python | 27e404493cd436106cdf493a81e4f074f5d5ab96 | [
"MIT"
] | null | null | null | src/database/addingData.py | inpritamkundu/python | 27e404493cd436106cdf493a81e4f074f5d5ab96 | [
"MIT"
] | null | null | null | import psycopg2
connection = psycopg2.connect(dbname="postgres", user="postgres",
password="mithukundu60@", host="localhost", port="5432")
print("connection established")
# Creating cursor
cursor = connection.cursor()
# Serial is used for generating sequence automatically
cursor.execute(... | 30.25 | 86 | 0.71281 | import psycopg2
connection = psycopg2.connect(dbname="postgres", user="postgres",
password="mithukundu60@", host="localhost", port="5432")
print("connection established")
cursor = connection.cursor()
cursor.execute(
'''INSERT INTO student(NAME,ADDRESS,AGE) VALUES('santosh','garwa',23... | true | true |
1c3238feee54598fe31e2521fe3f2e69ed774933 | 11,664 | py | Python | HadoopConnect/bin/clusters_handler.py | mshensg/hadoop-connect-for-splunk | 14afd1eb83753d6e1f95dcae49a27e3002070bbe | [
"Apache-2.0"
] | 1 | 2021-11-09T07:33:42.000Z | 2021-11-09T07:33:42.000Z | HadoopConnect/bin/clusters_handler.py | mshensg/hadoop-connect-for-splunk | 14afd1eb83753d6e1f95dcae49a27e3002070bbe | [
"Apache-2.0"
] | 2 | 2021-09-02T23:48:40.000Z | 2021-11-09T07:35:27.000Z | HadoopConnect/bin/clusters_handler.py | mshensg/hadoop-connect-for-splunk | 14afd1eb83753d6e1f95dcae49a27e3002070bbe | [
"Apache-2.0"
] | 2 | 2021-03-15T20:34:58.000Z | 2022-03-27T09:49:26.000Z | import os
import splunk.admin as admin
from clusters import *
from delegating_handler import DelegatingRestHandler
import constants
from errors import *
import util
required_args = ['uri'] # required on create
optional_args = ['namenode_http_port', 'hadoop_home', 'java_home', 'kerberos_principal', 'kerberos_service_p... | 46.285714 | 164 | 0.61154 | import os
import splunk.admin as admin
from clusters import *
from delegating_handler import DelegatingRestHandler
import constants
from errors import *
import util
required_args = ['uri'] optional_args = ['namenode_http_port', 'hadoop_home', 'java_home', 'kerberos_principal', 'kerberos_service_principal', 'ha', 'hdf... | true | true |
1c32398e7095398e8602f7d3c4d6512bd57639ff | 6,977 | py | Python | 21_autoencoder.py | juniwang/tensorflow-hw | 212223b2ea4ffe4f91e7ce2b55ba4f9c6797f767 | [
"MIT"
] | null | null | null | 21_autoencoder.py | juniwang/tensorflow-hw | 212223b2ea4ffe4f91e7ce2b55ba4f9c6797f767 | [
"MIT"
] | null | null | null | 21_autoencoder.py | juniwang/tensorflow-hw | 212223b2ea4ffe4f91e7ce2b55ba4f9c6797f767 | [
"MIT"
] | null | null | null | from __future__ import division, print_function, absolute_import
# disable warnings which are just informing you if you build TensorFlow from source it can be faster on your machine.
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
# Import ... | 36.721053 | 117 | 0.656443 | from __future__ import division, print_function, absolute_import
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=False)
lea... | true | true |
1c3239fb6450e7070cf99ff189993812fcfcd3d4 | 7,664 | py | Python | sqlcouch/models.py | dimagi/sqlcouch | ff264740d223185d80e0bf8ea11f6f3c8f3d7e7b | [
"BSD-3-Clause"
] | 1 | 2016-03-01T10:20:20.000Z | 2016-03-01T10:20:20.000Z | sqlcouch/models.py | dimagi/sqlcouch | ff264740d223185d80e0bf8ea11f6f3c8f3d7e7b | [
"BSD-3-Clause"
] | null | null | null | sqlcouch/models.py | dimagi/sqlcouch | ff264740d223185d80e0bf8ea11f6f3c8f3d7e7b | [
"BSD-3-Clause"
] | null | null | null | import base64
from couchdbkit import Database, ResourceNotFound, resource
from couchdbkit.ext.django.schema import Document
from django.db import models, transaction
import json
import uuid
from couchdbkit.exceptions import ResourceConflict
class SQLDocDB(Database):
def delete_doc(self, doc, **params):
fo... | 34.214286 | 78 | 0.594207 | import base64
from couchdbkit import Database, ResourceNotFound, resource
from couchdbkit.ext.django.schema import Document
from django.db import models, transaction
import json
import uuid
from couchdbkit.exceptions import ResourceConflict
class SQLDocDB(Database):
def delete_doc(self, doc, **params):
fo... | true | true |
1c323ad2feb1f7eec6edfed83be15809e4df3fed | 970 | py | Python | Data Manipulation with Pandas/reindexing_methods.py | zack28/TakenMind-Internship | 7fb7c1c0b255ee233f18fd9ab4fa76a9b2c992d7 | [
"MIT"
] | 4 | 2019-07-05T22:28:21.000Z | 2021-11-08T12:45:15.000Z | Data Manipulation with Pandas/reindexing_methods.py | zack28/TakenMind-Internship | 7fb7c1c0b255ee233f18fd9ab4fa76a9b2c992d7 | [
"MIT"
] | null | null | null | Data Manipulation with Pandas/reindexing_methods.py | zack28/TakenMind-Internship | 7fb7c1c0b255ee233f18fd9ab4fa76a9b2c992d7 | [
"MIT"
] | 5 | 2020-07-23T18:15:33.000Z | 2021-09-14T14:34:40.000Z | import numpy as np
import pandas as pd
from pandas import Series,DataFrame
from numpy.random import randn
#create a new series
s1=Series([1,2,3,4],index=['e','f','g','h'])
print(s1)
#creating new indexes using reindex
s2=s1.reindex(['e','f','g','h','i','j'])
print(s2)
#using fill value
s2=s2.reindex(... | 24.25 | 101 | 0.605155 | import numpy as np
import pandas as pd
from pandas import Series,DataFrame
from numpy.random import randn
s1=Series([1,2,3,4],index=['e','f','g','h'])
print(s1)
s2=s1.reindex(['e','f','g','h','i','j'])
print(s2)
s2=s2.reindex(['e','f','g','h','i','j','k'],fill_value=10)
print(s2)
cars=Series(['Audi'... | true | true |
1c323b3ab9ea1bba0d26414302fd4c5c78be2980 | 1,454 | py | Python | src/streamlink/plugins/mrtmk.py | hymer-up/streamlink | f09bf6e04cddc78eceb9ded655f716ef3ee4b84f | [
"BSD-2-Clause"
] | 5 | 2019-07-26T17:03:26.000Z | 2020-10-17T23:23:43.000Z | src/streamlink/plugins/mrtmk.py | hymer-up/streamlink | f09bf6e04cddc78eceb9ded655f716ef3ee4b84f | [
"BSD-2-Clause"
] | 9 | 2018-01-14T15:20:23.000Z | 2021-03-08T20:29:51.000Z | src/streamlink/plugins/mrtmk.py | hymer-up/streamlink | f09bf6e04cddc78eceb9ded655f716ef3ee4b84f | [
"BSD-2-Clause"
] | 4 | 2018-01-14T13:27:25.000Z | 2021-11-15T22:28:30.000Z | import logging
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
log = logging.getLogger(__name__)
class MRTmk(Plugin):
url_re = re.compile(r"""https?://play.mrt.com.mk/(live|play)/""")
file_re = re.compile(r"""(?P<url>https?://... | 29.673469 | 99 | 0.589409 | import logging
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
log = logging.getLogger(__name__)
class MRTmk(Plugin):
url_re = re.compile(r"""https?://play.mrt.com.mk/(live|play)/""")
file_re = re.compile(r"""(?P<url>https?://... | true | true |
1c323be4d60185e31f821e471d54bc21e0f55f33 | 3,604 | py | Python | python/pb/envoy/type/matcher/path_pb2.py | adriangb/enterprise-client | 5d50b457425b0c6d08415b0d986fa9151b792151 | [
"Apache-2.0"
] | null | null | null | python/pb/envoy/type/matcher/path_pb2.py | adriangb/enterprise-client | 5d50b457425b0c6d08415b0d986fa9151b792151 | [
"Apache-2.0"
] | null | null | null | python/pb/envoy/type/matcher/path_pb2.py | adriangb/enterprise-client | 5d50b457425b0c6d08415b0d986fa9151b792151 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: envoy/type/matcher/path.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
fro... | 41.425287 | 473 | 0.791065 | from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default()
from envoy.type.matcher import string_pb2 as envoy_dot_type_... | true | true |
1c323c0e31e11baddab9c8e810045324e97e9a2d | 25,490 | py | Python | neurst/tasks/cross_modal_translation.py | ReneeYe/XSTNet | c5e508aed878d13fea790caee71db1ce77619465 | [
"Apache-2.0"
] | 16 | 2021-06-22T02:36:32.000Z | 2022-03-27T23:07:55.000Z | neurst/tasks/cross_modal_translation.py | ReneeYe/XSTNet | c5e508aed878d13fea790caee71db1ce77619465 | [
"Apache-2.0"
] | 1 | 2022-03-12T13:28:23.000Z | 2022-03-12T13:28:23.000Z | neurst/tasks/cross_modal_translation.py | ReneeYe/XSTNet | c5e508aed878d13fea790caee71db1ce77619465 | [
"Apache-2.0"
] | 3 | 2021-08-03T12:49:35.000Z | 2021-09-02T03:58:18.000Z | # Copyright 2020 ByteDance Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 50.475248 | 131 | 0.60255 | from typing import Tuple
import numpy as np
import tensorflow as tf
from absl import logging
import neurst.data.dataset_utils as dataset_utils
from neurst.data.data_pipelines import DataPipeline, build_data_pipeline
from neurst.data.data_pipelines.tagged_text_data_pipeline import TaggedTextDataPipeline
from neurst.dat... | true | true |
1c323c3fc4e3462da91c1c2ee4031a1da2a11473 | 126 | py | Python | week06_1/static_demo/myproject/myapp/models.py | wasit7/cs459_django2018 | 77c09712ac5328d9bba285c000d25d86dbc363b1 | [
"BSD-2-Clause"
] | 4 | 2018-01-17T06:51:24.000Z | 2019-05-01T15:45:17.000Z | week06_1/static_demo/myproject/myapp/models.py | wasit7/cs459_django2018 | 77c09712ac5328d9bba285c000d25d86dbc363b1 | [
"BSD-2-Clause"
] | null | null | null | week06_1/static_demo/myproject/myapp/models.py | wasit7/cs459_django2018 | 77c09712ac5328d9bba285c000d25d86dbc363b1 | [
"BSD-2-Clause"
] | 3 | 2018-04-04T06:54:08.000Z | 2019-03-06T02:31:16.000Z | from django.db import models
# Create your models here.
class Car(models.Model):
image = models.ImageField(upload_to='cars') | 25.2 | 44 | 0.769841 | from django.db import models
class Car(models.Model):
image = models.ImageField(upload_to='cars') | true | true |
1c323c7ad0cf673c86820e22a1ccf3368afdf661 | 6,276 | py | Python | nuqql_matrixd/server.py | hwipl/nuqql-matrixd | 8120ec8bf5a3818726ad2b30f23f9f05fb37c9ec | [
"MIT"
] | null | null | null | nuqql_matrixd/server.py | hwipl/nuqql-matrixd | 8120ec8bf5a3818726ad2b30f23f9f05fb37c9ec | [
"MIT"
] | null | null | null | nuqql_matrixd/server.py | hwipl/nuqql-matrixd | 8120ec8bf5a3818726ad2b30f23f9f05fb37c9ec | [
"MIT"
] | null | null | null | """
matrixd backend server
"""
import html
import re
from typing import TYPE_CHECKING, Dict, Optional, Tuple
# nuqq-based imports
from nuqql_based.based import Based
from nuqql_based.callback import Callback
from nuqql_based.message import Message
# matrixd imports
from nuqql_matrixd.client import BackendClient
fro... | 31.857868 | 79 | 0.578235 |
import html
import re
from typing import TYPE_CHECKING, Dict, Optional, Tuple
from nuqql_based.based import Based
from nuqql_based.callback import Callback
from nuqql_based.message import Message
from nuqql_matrixd.client import BackendClient
from nuqql_matrixd.matrix import unescape_name
if TYPE_CHECKING: ... | true | true |
1c323c889b5ddf67e0a8df74329016f418433b1a | 45,065 | py | Python | api_gateway/models.py | navigateconsulting/va-grievance-redressal | b5a6f28fa0bbaa2c10eb6e6cb553a7407e1027d4 | [
"Apache-2.0"
] | null | null | null | api_gateway/models.py | navigateconsulting/va-grievance-redressal | b5a6f28fa0bbaa2c10eb6e6cb553a7407e1027d4 | [
"Apache-2.0"
] | 1 | 2021-03-10T04:00:41.000Z | 2021-03-10T04:00:41.000Z | api_gateway/models.py | navigateconsulting/va-grievance-redressal | b5a6f28fa0bbaa2c10eb6e6cb553a7407e1027d4 | [
"Apache-2.0"
] | null | null | null | from bson.json_util import dumps
import json
from bson.objectid import ObjectId
from database import ConDatabase
from config import CONFIG
'''motor Mongo Db connection '''
db = ConDatabase.connect()
# noinspection PyMethodMayBeStatic
class RasaConversations:
async def get_conversations(self, sender_id):
... | 42.474081 | 147 | 0.614601 | from bson.json_util import dumps
import json
from bson.objectid import ObjectId
from database import ConDatabase
from config import CONFIG
db = ConDatabase.connect()
class RasaConversations:
async def get_conversations(self, sender_id):
print("Pulling tracker data for a conversation")
result ... | true | true |
1c323d974d565283fe3537ebf68aa347c5a46301 | 13,147 | py | Python | Utils.py | AGDCservices/Ghidra-Scripts | 4b891cb5bc1593e398652be50f27001964575bf9 | [
"Apache-2.0"
] | 38 | 2020-04-09T18:25:52.000Z | 2022-03-22T23:51:58.000Z | Ghidra-Scripts/Utils.py | paulveillard/cybersecurity-networking | 097fda0bb22baf0610ca274cf65af324908b53ce | [
"Apache-2.0"
] | null | null | null | Ghidra-Scripts/Utils.py | paulveillard/cybersecurity-networking | 097fda0bb22baf0610ca274cf65af324908b53ce | [
"Apache-2.0"
] | 2 | 2022-01-31T10:53:53.000Z | 2022-02-25T17:55:27.000Z | from __main__ import *
'''
Utility module of common helper functions used
in building Ghidra scripts
Contained function prototypes below:
Get_Bytes_List(targetEa, nLen)
Get_Bytes_String(targetEa, nLen)
Get_Ascii_String(targetEa)
Get_Call_Xrefs_To(targetEa)
Get_Prev_Target_Instruction(cu... | 35.822888 | 141 | 0.633376 | from __main__ import *
def Get_Bytes_List(targetEa, nLen):
signedList = list(getBytes(targetEa, nLen))
unsignedList = []
for curByte in signedList:
if curByte < 0:
uByte = (0xff - abs(curByte) + 1)
else:
uByte= curByte
unsignedList.append(uByte)... | true | true |
1c323dd44e1673bf9dd42ec3a02856b6ac02b476 | 14,959 | py | Python | tests/integration_tests/tests/agent_tests/test_plugin_update.py | ilan-WS/cloudify-manager | 510d8a277c848db351f38fc5b264806b2cb36d0b | [
"Apache-2.0"
] | null | null | null | tests/integration_tests/tests/agent_tests/test_plugin_update.py | ilan-WS/cloudify-manager | 510d8a277c848db351f38fc5b264806b2cb36d0b | [
"Apache-2.0"
] | 2 | 2021-05-31T15:12:21.000Z | 2021-05-31T19:03:05.000Z | tests/integration_tests/tests/agent_tests/test_plugin_update.py | ilan-WS/cloudify-manager | 510d8a277c848db351f38fc5b264806b2cb36d0b | [
"Apache-2.0"
] | null | null | null | ########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. 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... | 37.775253 | 79 | 0.652584 |
import os
import uuid
import shutil
import pytest
from functools import wraps
import integration_tests_plugins
from manager_rest.plugins_update.constants import STATES
from integration_tests import AgentTestWithPlugins
from integration_tests.tests.utils import (
get_resource as resource,
wait_for_blueprint_... | true | true |
1c323dd5c55b25237b61591ef9e174f70d4ac376 | 717 | py | Python | tests/project/ethpm/test_release_package.py | ActorForth/brownie | ef0d5af3bb48edcd11abf985626fc99dbc577c7d | [
"MIT"
] | 1,595 | 2020-06-01T19:41:53.000Z | 2022-03-31T16:09:54.000Z | tests/project/ethpm/test_release_package.py | ActorForth/brownie | ef0d5af3bb48edcd11abf985626fc99dbc577c7d | [
"MIT"
] | 532 | 2020-05-30T12:06:17.000Z | 2022-03-31T22:33:41.000Z | tests/project/ethpm/test_release_package.py | ActorForth/brownie | ef0d5af3bb48edcd11abf985626fc99dbc577c7d | [
"MIT"
] | 303 | 2020-06-17T00:38:34.000Z | 2022-03-31T10:59:48.000Z | #!/usr/bin/python3
from brownie.project import ethpm
ETHPM_CONFIG = {
"package_name": "testpackage",
"version": "1.0.0",
"settings": {"deployment_networks": False, "include_dependencies": False},
}
def test_release_package(dep_project, accounts):
registry = dep_project.PackageRegistry.deploy({"from"... | 34.142857 | 85 | 0.716876 |
from brownie.project import ethpm
ETHPM_CONFIG = {
"package_name": "testpackage",
"version": "1.0.0",
"settings": {"deployment_networks": False, "include_dependencies": False},
}
def test_release_package(dep_project, accounts):
registry = dep_project.PackageRegistry.deploy({"from": accounts[0]})
... | true | true |
1c32403f57f0bfce2a895a27800a35689f7f3a13 | 13,264 | py | Python | client/buck.py | HybridDeveloper/pyre-check | 48d1f8bbf19003417e64950561c786e28af1251a | [
"MIT"
] | null | null | null | client/buck.py | HybridDeveloper/pyre-check | 48d1f8bbf19003417e64950561c786e28af1251a | [
"MIT"
] | null | null | null | client/buck.py | HybridDeveloper/pyre-check | 48d1f8bbf19003417e64950561c786e28af1251a | [
"MIT"
] | null | null | null | # Copyright 2004-present Facebook. All rights reserved.
import functools
import glob
import json
import logging
import os
import subprocess
import sys
import tempfile
import threading
from collections import namedtuple
from json.decoder import JSONDecodeError
from logging import Logger
from typing import Dict, Iterab... | 35.370667 | 88 | 0.592355 |
import functools
import glob
import json
import logging
import os
import subprocess
import sys
import tempfile
import threading
from collections import namedtuple
from json.decoder import JSONDecodeError
from logging import Logger
from typing import Dict, Iterable, List, NamedTuple, Optional, Set, Tuple
from .filesys... | true | true |
1c3240a9ef8ce71b19868e80a1044a5fad11c103 | 15,393 | py | Python | train_tar_visda.py | Albert0147/G-SFDA | a927c67afd71152090d5415142fe8dec9330eeec | [
"MIT"
] | 50 | 2021-07-25T23:58:13.000Z | 2022-03-24T06:01:19.000Z | train_tar_visda.py | davidpengiupui/G-SFDA | 6ded750224266cd4cdb100a7fcedfa95688d22da | [
"MIT"
] | 10 | 2021-08-10T07:14:29.000Z | 2022-02-11T15:51:53.000Z | train_tar_visda.py | davidpengiupui/G-SFDA | 6ded750224266cd4cdb100a7fcedfa95688d22da | [
"MIT"
] | 9 | 2021-08-11T06:48:39.000Z | 2022-03-03T06:14:41.000Z | import argparse
import os, sys
import os.path as osp
import torchvision
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import transforms
import network, loss
from torch.utils.data import DataLoader
from data_list import ImageList, ImageList_idx
import random, pdb, mat... | 37.181159 | 116 | 0.535438 | import argparse
import os, sys
import os.path as osp
import torchvision
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import transforms
import network, loss
from torch.utils.data import DataLoader
from data_list import ImageList, ImageList_idx
import random, pdb, mat... | true | true |
1c3240f5219e381a34891036fae6c23256494899 | 1,255 | py | Python | qlworkbench/ui/event_manager.py | threkk/software-construction | ddabf113b8a58b9e6f6fc2d4c6539df1a38c010a | [
"MIT"
] | null | null | null | qlworkbench/ui/event_manager.py | threkk/software-construction | ddabf113b8a58b9e6f6fc2d4c6539df1a38c010a | [
"MIT"
] | 7 | 2017-04-22T14:51:38.000Z | 2017-12-10T18:51:36.000Z | qlworkbench/ui/event_manager.py | threkk/software-construction | ddabf113b8a58b9e6f6fc2d4c6539df1a38c010a | [
"MIT"
] | 1 | 2017-12-10T18:51:06.000Z | 2017-12-10T18:51:06.000Z | # -*- coding: utf-8 -*-
"""
This module defines a simple event manager that works on a basis of publishers
and subscribers. This is used in combination with the class `ui.context` to
update the values of the variables when they change.
"""
class EventManager(object):
"""
Simple event manager based on the bull... | 35.857143 | 78 | 0.67012 |
class EventManager(object):
def __init__(self, updater):
self._subscriptions = {}
self.updater = updater
def get_publishers(self):
return self._subscriptions.keys()
def subscribe(self, subscriber, publisher):
if publisher in self._subscriptions:
self._subscrip... | true | true |
1c32419673cc54be598a53cc174e927a74ba172d | 3,866 | py | Python | sdk/identity/azure-identity/azure/identity/aio/_credentials/imds.py | rnestler/azure-sdk-for-python | 3d9c14789a5f468b3a1c8b57575e54cbdad708eb | [
"MIT"
] | null | null | null | sdk/identity/azure-identity/azure/identity/aio/_credentials/imds.py | rnestler/azure-sdk-for-python | 3d9c14789a5f468b3a1c8b57575e54cbdad708eb | [
"MIT"
] | null | null | null | sdk/identity/azure-identity/azure/identity/aio/_credentials/imds.py | rnestler/azure-sdk-for-python | 3d9c14789a5f468b3a1c8b57575e54cbdad708eb | [
"MIT"
] | null | null | null | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import os
from typing import TYPE_CHECKING
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError
from ... import CredentialUnavailableError
fr... | 46.578313 | 112 | 0.667874 | import os
from typing import TYPE_CHECKING
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError
from ... import CredentialUnavailableError
from ..._constants import EnvironmentVariables
from .._internal import AsyncContextManager
from .._internal.get_token_mixin import GetTokenMixin
from .._... | true | true |
1c3241db512ddaf8a597300f679ee9b33bd2b0ae | 3,087 | py | Python | superviselySDK/help/jupyterlab_scripts/src/backup/project_inference.py | nicehuster/mmdetection-supervisely-person-datasets | ff1b57e16a71378510571dbb9cebfdb712656927 | [
"Apache-2.0"
] | 40 | 2019-05-05T08:08:18.000Z | 2021-10-17T00:07:58.000Z | superviselySDK/help/jupyterlab_scripts/src/backup/project_inference.py | nicehuster/mmdetection-supervisely-person-datasets | ff1b57e16a71378510571dbb9cebfdb712656927 | [
"Apache-2.0"
] | 8 | 2019-06-13T06:00:08.000Z | 2021-07-24T05:25:33.000Z | superviselySDK/help/jupyterlab_scripts/src/backup/project_inference.py | nicehuster/mmdetection-supervisely-person-datasets | ff1b57e16a71378510571dbb9cebfdb712656927 | [
"Apache-2.0"
] | 6 | 2019-07-30T06:36:27.000Z | 2021-06-03T11:57:36.000Z | # coding: utf-8
import time
from tqdm import tqdm
import supervisely_lib as sly
address = 'http://192.168.1.69:5555'
token = 'YGPDnuBkhFmcQ7VNzSEjhgavjg4eFR4Eq1C3jIY4HgV3SQq2JgkXCNtgZy1Fu2ftd4IKui8DsjrdtXjB853cMtBevpSJqFDYiaG1A5qphlH6fFiYYmcVZ5fMR8dDrt5l'
team_name = 'dima'
workspace_name = 'work'
agent_name = 'dima_a... | 35.482759 | 138 | 0.761905 | import time
from tqdm import tqdm
import supervisely_lib as sly
address = 'http://192.168.1.69:5555'
token = 'YGPDnuBkhFmcQ7VNzSEjhgavjg4eFR4Eq1C3jIY4HgV3SQq2JgkXCNtgZy1Fu2ftd4IKui8DsjrdtXjB853cMtBevpSJqFDYiaG1A5qphlH6fFiYYmcVZ5fMR8dDrt5l'
team_name = 'dima'
workspace_name = 'work'
agent_name = 'dima_agent'
model_name... | true | true |
1c32444a262755d1f0837b4dccf7b218ba34597b | 3,247 | py | Python | python/TypeHandlers.py | rsejaa/oracle-db-examples | 8b91baf801e9a67b357f38f187f103824f70d310 | [
"Apache-2.0"
] | 4 | 2019-10-26T06:21:32.000Z | 2021-02-15T15:28:02.000Z | python/TypeHandlers.py | rsejaa/oracle-db-examples | 8b91baf801e9a67b357f38f187f103824f70d310 | [
"Apache-2.0"
] | null | null | null | python/TypeHandlers.py | rsejaa/oracle-db-examples | 8b91baf801e9a67b357f38f187f103824f70d310 | [
"Apache-2.0"
] | 5 | 2019-10-26T06:21:31.000Z | 2022-03-10T12:47:13.000Z | #------------------------------------------------------------------------------
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
#
# Portions Copyright 2007-2015, Anthony Tuininga. All rights reserved.
#
# Portions Copyright 2001-2007, Computronix (Canada) Ltd., Edmonton, Alberta,
# Canada... | 33.822917 | 79 | 0.642439 |
from __future__ import print_function
import cx_Oracle
import datetime
import SampleEnv
con = cx_Oracle.connect(SampleEnv.GetMainConnectString())
objType = con.gettype("UDT_BUILDING")
class Building(object):
def __init__(self, buildingId, description, numFloors, dateBuilt):
self.buildingId = building... | true | true |
1c3245ac2a6e13af8b1c8775f8d82b178321ba8f | 10,263 | py | Python | Day33_Transfer_learning_Multiclass_classification/assignment3_pythonformat.py | activatedbonkers/100-Days-of-Code-Challenge | a1a376e5373d8fc5fda5df4004115760aa92bfda | [
"MIT"
] | 8 | 2020-07-12T22:45:30.000Z | 2021-06-01T10:44:28.000Z | Day33_Transfer_learning_Multiclass_classification/assignment3_pythonformat.py | activatedbonkers/100-Days-of-Code-Challenge | a1a376e5373d8fc5fda5df4004115760aa92bfda | [
"MIT"
] | null | null | null | Day33_Transfer_learning_Multiclass_classification/assignment3_pythonformat.py | activatedbonkers/100-Days-of-Code-Challenge | a1a376e5373d8fc5fda5df4004115760aa92bfda | [
"MIT"
] | 6 | 2020-06-29T18:36:27.000Z | 2022-01-16T21:18:03.000Z | #!/usr/bin/env python
# coding: utf-8
# In[28]:
# ATTENTION: Please do not alter any of the provided code in the exercise. Only add your own code where indicated
# ATTENTION: Please do not add or remove any cells in the exercise. The grader will check specific cells based on the cell position.
# ATTENTION: Please us... | 36.393617 | 179 | 0.614343 |
import os
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras import Model
from os import getcwd
path_inception = f"{getcwd()}/../tmp2/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5"
from tensorflow.keras.applications.inception_v3 import InceptionV3
local_weights_file =... | true | true |
1c3246003698d71f80462f458c37d5f898f28798 | 2,481 | py | Python | tests/unit/model_selection/test_time_splitter.py | betatim/hcrystalball | 693b9b406f05afa23cfc4647c43260166a7076fe | [
"MIT"
] | null | null | null | tests/unit/model_selection/test_time_splitter.py | betatim/hcrystalball | 693b9b406f05afa23cfc4647c43260166a7076fe | [
"MIT"
] | null | null | null | tests/unit/model_selection/test_time_splitter.py | betatim/hcrystalball | 693b9b406f05afa23cfc4647c43260166a7076fe | [
"MIT"
] | null | null | null | import pytest
import types
import numpy as np
from hcrystalball.model_selection import FinerTimeSplit
@pytest.mark.parametrize(
"ts_data, expected_error",
[
("series", None),
("series_with_NaN", None),
("series_with_Inf", None),
("series_with_name", None),
("series_with... | 37.029851 | 109 | 0.622733 | import pytest
import types
import numpy as np
from hcrystalball.model_selection import FinerTimeSplit
@pytest.mark.parametrize(
"ts_data, expected_error",
[
("series", None),
("series_with_NaN", None),
("series_with_Inf", None),
("series_with_name", None),
("series_with... | true | true |
1c324767b609766f14f0328cf7c1effc49be065a | 5,067 | py | Python | geoprisma/core/proxies/proxy.py | groupe-conseil-nutshimit-nippour/django-geoprisma | 4732fdb8a0684eb4d7fd50aa43e11b454ee71d08 | [
"BSD-3-Clause"
] | null | null | null | geoprisma/core/proxies/proxy.py | groupe-conseil-nutshimit-nippour/django-geoprisma | 4732fdb8a0684eb4d7fd50aa43e11b454ee71d08 | [
"BSD-3-Clause"
] | 5 | 2020-02-12T00:23:17.000Z | 2021-12-13T19:46:33.000Z | geoprisma/core/proxies/proxy.py | groupe-conseil-nutshimit-nippour/django-geoprisma | 4732fdb8a0684eb4d7fd50aa43e11b454ee71d08 | [
"BSD-3-Clause"
] | null | null | null | import urllib
import requests
from geoprisma.utils import isAuthorized
from geoprisma.models import Resource, Datastore
from django.contrib.auth.models import User
class Proxy(object):
"""
Class Proxy de base.
Tout les autres proxy herite de cette classe.
"""
CRUD_CREATE = "create"
CRUD_READ... | 29.982249 | 105 | 0.606671 | import urllib
import requests
from geoprisma.utils import isAuthorized
from geoprisma.models import Resource, Datastore
from django.contrib.auth.models import User
class Proxy(object):
CRUD_CREATE = "create"
CRUD_READ = "read"
CRUD_UPDATE = "update"
CRUD_DELETE = "delete"
def __init__(self, serv... | true | true |
1c3247a0889f339178ae9f87828ca4db9cc9425f | 2,017 | py | Python | profiler/tests/test_metrics_use_case.py | Hydrospheredata/hydro-profiler | bca177f8d71d9d8c93091f9a9fdf9a337582e194 | [
"Apache-2.0"
] | null | null | null | profiler/tests/test_metrics_use_case.py | Hydrospheredata/hydro-profiler | bca177f8d71d9d8c93091f9a9fdf9a337582e194 | [
"Apache-2.0"
] | 14 | 2021-11-22T18:07:28.000Z | 2022-01-14T08:51:45.000Z | profiler/tests/test_metrics_use_case.py | Hydrospheredata/hydro-profiler | bca177f8d71d9d8c93091f9a9fdf9a337582e194 | [
"Apache-2.0"
] | 1 | 2021-11-19T11:16:50.000Z | 2021-11-19T11:16:50.000Z | from datetime import datetime
import logging
import pandas as pd
from profiler.use_cases.aggregation_use_case import AggregationUseCase
from profiler.use_cases.metrics_use_case import MetricsUseCase
from profiler.use_cases.overall_reports_use_case import OverallReportsUseCase
from profiler.use_cases.report_use_case im... | 33.065574 | 85 | 0.71294 | from datetime import datetime
import logging
import pandas as pd
from profiler.use_cases.aggregation_use_case import AggregationUseCase
from profiler.use_cases.metrics_use_case import MetricsUseCase
from profiler.use_cases.overall_reports_use_case import OverallReportsUseCase
from profiler.use_cases.report_use_case im... | true | true |
1c324880a6a23d41039b545031dffb2f396c642f | 640 | py | Python | pokebot/bots/utils.py | nacharya114/pokebot | b9028c86c5ee58178f348c75c39225f7b55507aa | [
"MIT"
] | 1 | 2020-05-20T04:52:24.000Z | 2020-05-20T04:52:24.000Z | pokebot/bots/utils.py | nacharya114/pokebot | b9028c86c5ee58178f348c75c39225f7b55507aa | [
"MIT"
] | null | null | null | pokebot/bots/utils.py | nacharya114/pokebot | b9028c86c5ee58178f348c75c39225f7b55507aa | [
"MIT"
] | null | null | null | #########################
# Author: Neil Acharya
#
# Helper Functions
#########################
def teampreview_performance(mon_a, mon_b):
# We evaluate the performance on mon_a against mon_b as its type advantage
a_on_b = b_on_a = -np.inf
for type_ in mon_a.types:
if type_:
... | 33.684211 | 79 | 0.604688 |
def teampreview_performance(mon_a, mon_b):
a_on_b = b_on_a = -np.inf
for type_ in mon_a.types:
if type_:
a_on_b = max(a_on_b, type_.damage_multiplier(*mon_b.types))
for type_ in mon_b.types:
if type_:
b_on_a = max(b_on_a, type_.damage_multiplier(*mon_... | true | true |
1c3248f3bf60c84c3eccf88a80508685e532ac42 | 110,825 | py | Python | python/pyarrow/tests/test_parquet.py | maxburke/arrow | 344ed4bed675c4913db5cc7b17d0e6cc57ea55c4 | [
"Apache-2.0"
] | 1 | 2019-12-27T14:15:07.000Z | 2019-12-27T14:15:07.000Z | python/pyarrow/tests/test_parquet.py | maxburke/arrow | 344ed4bed675c4913db5cc7b17d0e6cc57ea55c4 | [
"Apache-2.0"
] | null | null | null | python/pyarrow/tests/test_parquet.py | maxburke/arrow | 344ed4bed675c4913db5cc7b17d0e6cc57ea55c4 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... | 32.471433 | 79 | 0.62808 |
from collections import OrderedDict
import datetime
import decimal
import io
import json
import os
import six
import pickle
import pytest
import numpy as np
import pyarrow as pa
from pyarrow.compat import guid, u, BytesIO, unichar, PY2
from pyarrow.pandas_compat import _pandas_api
from pyarrow.tests import util
from... | true | true |
1c32496c17e9581c86d34b7887b8f58526c8d8c6 | 8,188 | py | Python | txaws/client/discover/tests/test_command.py | antisvin/txAWS | 752fb1ac243b56f8eef8b5773faf7dc475e0a2d3 | [
"MIT"
] | null | null | null | txaws/client/discover/tests/test_command.py | antisvin/txAWS | 752fb1ac243b56f8eef8b5773faf7dc475e0a2d3 | [
"MIT"
] | null | null | null | txaws/client/discover/tests/test_command.py | antisvin/txAWS | 752fb1ac243b56f8eef8b5773faf7dc475e0a2d3 | [
"MIT"
] | null | null | null | # Copyright (C) 2010 Jamu Kakar <jkakar@kakar.ca>
# Licenced under the txaws licence available at /LICENSE in the txaws source.
"""Unit tests for L{Command}."""
from cStringIO import StringIO
from twisted.internet.defer import succeed, fail
from twisted.web.error import Error
from txaws.client.discover.command impo... | 39.941463 | 79 | 0.541402 |
from cStringIO import StringIO
from twisted.internet.defer import succeed, fail
from twisted.web.error import Error
from txaws.client.discover.command import Command
from txaws.ec2.client import Query
from txaws.testing.base import TXAWSTestCase
class FakeHTTPClient(object):
def __init__(self, status, url):
... | true | true |
1c32498b312c0dafb9282c89fa7abd0d5bad2428 | 5,246 | py | Python | src/wip/gesture_sensor.py | dooley-ch/microbit-grove | e25213de74d982b8ab49412e6f8b2dbe205ca932 | [
"MIT"
] | null | null | null | src/wip/gesture_sensor.py | dooley-ch/microbit-grove | e25213de74d982b8ab49412e6f8b2dbe205ca932 | [
"MIT"
] | null | null | null | src/wip/gesture_sensor.py | dooley-ch/microbit-grove | e25213de74d982b8ab49412e6f8b2dbe205ca932 | [
"MIT"
] | null | null | null | # ------------------------------------------------------------------------------------------
# Copyright James A. Dooley 2021.
#
# Distributed under the MIT License.
# (See accompanying file license.md file or copy at http://opensource.org/licenses/MIT)
#
# --------------------------------------------------------------... | 24.514019 | 92 | 0.548227 |
from microbit import sleep, i2c, display, button_b
_DEFAULT_ADDRESS = 0x73
_PAJ_BANK_SELECT = 0xEF
_PAJ_SUSPEND = 0x03
_PAJ_INT_FLAG1_MASK = 0x41
_PAJ_INT_FLAG2_MASK = 0x42
_PAJ_INT_FLAG1 = 0x43
_PAJ_INT_FLAG2 = 0x44
_PAJ_STATE = 0x45
_PAJ_PS_HIGH_THRESHOLD = ... | true | true |
1c3249f151b296b7c4243a282c5dc5d6d62b2a3c | 3,282 | py | Python | core/controllers/practice_sessions.py | alexewu/oppia | 57c3c660ab7974835ec068d7c7f5ce5b5f1f25ae | [
"Apache-2.0"
] | null | null | null | core/controllers/practice_sessions.py | alexewu/oppia | 57c3c660ab7974835ec068d7c7f5ce5b5f1f25ae | [
"Apache-2.0"
] | null | null | null | core/controllers/practice_sessions.py | alexewu/oppia | 57c3c660ab7974835ec068d7c7f5ce5b5f1f25ae | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 36.466667 | 80 | 0.71816 |
from constants import constants
from core.controllers import acl_decorators
from core.controllers import base
from core.domain import dependency_registry
from core.domain import interaction_registry
from core.domain import obj_services
from core.domain import topic_services
import feconf
import jinja2
class Practic... | true | true |
1c324a0f97c8047fe482e12b573d06c176522100 | 1,319 | py | Python | reconcile/test/test_aws_iam_keys.py | bhushanthakur93/qontract-reconcile | fd8eea9f92d353224113955d08e3592864e37df8 | [
"Apache-2.0"
] | null | null | null | reconcile/test/test_aws_iam_keys.py | bhushanthakur93/qontract-reconcile | fd8eea9f92d353224113955d08e3592864e37df8 | [
"Apache-2.0"
] | null | null | null | reconcile/test/test_aws_iam_keys.py | bhushanthakur93/qontract-reconcile | fd8eea9f92d353224113955d08e3592864e37df8 | [
"Apache-2.0"
] | null | null | null | from unittest import TestCase
import reconcile.aws_iam_keys as integ
class TestSupportFunctions(TestCase):
def test_filter_accounts_with_account_name(self):
a = {"name": "a", "deleteKeys": ["AKIA"]}
b = {"name": "b", "deleteKeys": ["AKIA"]}
accounts = [a, b]
filtered = integ.filter... | 37.685714 | 61 | 0.595906 | from unittest import TestCase
import reconcile.aws_iam_keys as integ
class TestSupportFunctions(TestCase):
def test_filter_accounts_with_account_name(self):
a = {"name": "a", "deleteKeys": ["AKIA"]}
b = {"name": "b", "deleteKeys": ["AKIA"]}
accounts = [a, b]
filtered = integ.filter... | true | true |
1c324b9156101cf95bb2610012f39493cc8a3eb8 | 4,633 | py | Python | fastapi/encoders.py | facundojmaero/fastapi | a6897963d5ff2c836313c3b69fc6062051c07a63 | [
"MIT"
] | 1 | 2021-05-28T11:08:43.000Z | 2021-05-28T11:08:43.000Z | fastapi/encoders.py | ycd/fastapi | 848e7f27ed8018e280d40e223a99b9d9e3689734 | [
"MIT"
] | null | null | null | fastapi/encoders.py | ycd/fastapi | 848e7f27ed8018e280d40e223a99b9d9e3689734 | [
"MIT"
] | null | null | null | from collections import defaultdict
from enum import Enum
from pathlib import PurePath
from types import GeneratorType
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
from pydantic import BaseModel
from pydantic.json import ENCODERS_BY_TYPE
SetIntStr = Set[Union[int, str]]
DictIntStrAny = Di... | 33.817518 | 81 | 0.599611 | from collections import defaultdict
from enum import Enum
from pathlib import PurePath
from types import GeneratorType
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
from pydantic import BaseModel
from pydantic.json import ENCODERS_BY_TYPE
SetIntStr = Set[Union[int, str]]
DictIntStrAny = Di... | true | true |
1c324c21a8f61bee306884a09b43f1be586eddb5 | 1,721 | py | Python | apps/challenges/migrations/0028_zip_configuration_models_for_challenge_creation.py | ChrsMark/EvalAI | d70163a2465a5d69e818a342ae75f6b0a8eb4cea | [
"BSD-3-Clause"
] | 3 | 2019-02-24T10:57:09.000Z | 2019-02-24T16:49:32.000Z | apps/challenges/migrations/0028_zip_configuration_models_for_challenge_creation.py | ChrsMark/EvalAI | d70163a2465a5d69e818a342ae75f6b0a8eb4cea | [
"BSD-3-Clause"
] | 4 | 2021-06-08T23:45:35.000Z | 2022-01-13T03:32:04.000Z | apps/challenges/migrations/0028_zip_configuration_models_for_challenge_creation.py | ChrsMark/EvalAI | d70163a2465a5d69e818a342ae75f6b0a8eb4cea | [
"BSD-3-Clause"
] | 1 | 2020-01-15T17:27:02.000Z | 2020-01-15T17:27:02.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-06-11 18:40
from __future__ import unicode_literals
import base.utils
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations... | 46.513514 | 151 | 0.669959 | from __future__ import unicode_literals
import base.utils
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('challenges', '... | true | true |
1c324e592c8d6f9d0243b4c45d7a67cd6472be33 | 1,771 | py | Python | lektor_markdown_header_anchors.py | emmapeel2/lektor-markdown-header-anchors | cba9fcbd3b5e5644bb1766d041a31a803fc9d09c | [
"BSD-3-Clause"
] | 14 | 2015-12-24T23:29:13.000Z | 2019-12-15T23:28:53.000Z | lektor_markdown_header_anchors.py | emmapeel2/lektor-markdown-header-anchors | cba9fcbd3b5e5644bb1766d041a31a803fc9d09c | [
"BSD-3-Clause"
] | 11 | 2016-01-26T17:21:56.000Z | 2020-03-29T19:39:02.000Z | lektor_markdown_header_anchors.py | emmapeel2/lektor-markdown-header-anchors | cba9fcbd3b5e5644bb1766d041a31a803fc9d09c | [
"BSD-3-Clause"
] | 12 | 2016-01-12T19:00:22.000Z | 2021-03-05T13:18:52.000Z | from lektor.pluginsystem import Plugin
import uuid
from lektor.utils import slugify
from markupsafe import Markup
from collections import namedtuple
TocEntry = namedtuple('TocEntry', ['anchor', 'title', 'children'])
class MarkdownHeaderAnchorsPlugin(Plugin):
name = 'Markdown Header Anchors'
description = u'... | 35.42 | 95 | 0.561265 | from lektor.pluginsystem import Plugin
import uuid
from lektor.utils import slugify
from markupsafe import Markup
from collections import namedtuple
TocEntry = namedtuple('TocEntry', ['anchor', 'title', 'children'])
class MarkdownHeaderAnchorsPlugin(Plugin):
name = 'Markdown Header Anchors'
description = u'... | true | true |
1c324eca209fb748e1712badce0c2051a7528294 | 135,834 | py | Python | mne/viz/_brain/_brain.py | dddd1007/mne-python | 844d53c866bbea932dd6c89ab444bb7f882f0b6f | [
"BSD-3-Clause"
] | null | null | null | mne/viz/_brain/_brain.py | dddd1007/mne-python | 844d53c866bbea932dd6c89ab444bb7f882f0b6f | [
"BSD-3-Clause"
] | null | null | null | mne/viz/_brain/_brain.py | dddd1007/mne-python | 844d53c866bbea932dd6c89ab444bb7f882f0b6f | [
"BSD-3-Clause"
] | null | null | null | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
# Oleh Kozynets <ok7mailbox@gmail.com>
# Guillaume Favelier <guillaume.favelier@gmail.com>
# jona-sassenhagen <jona.sassenhagen@gmail.com>
# Joan Massich <mailsik@gmail.com>
#... | 39.93943 | 79 | 0.540483 |
import contextlib
from functools import partial
from io import BytesIO
import os
import os.path as op
import sys
import time
import copy
import traceback
import warnings
import numpy as np
from collections import OrderedDict
from .colormap import calculate_lut
from .surface import _Surface
from .view import views_di... | true | true |
1c324ee8763179a0da8952250323994620a39714 | 1,184 | py | Python | dnaSequence/test_strandsAreNotEmpty.py | ankitsumitg/python-projects | 34a3df6fcd8544bf83aa9f3d47ec160e3838b1d1 | [
"MIT"
] | 1 | 2021-03-22T20:45:06.000Z | 2021-03-22T20:45:06.000Z | dnaSequence/test_strandsAreNotEmpty.py | ankitsumitg/python-projects | 34a3df6fcd8544bf83aa9f3d47ec160e3838b1d1 | [
"MIT"
] | null | null | null | dnaSequence/test_strandsAreNotEmpty.py | ankitsumitg/python-projects | 34a3df6fcd8544bf83aa9f3d47ec160e3838b1d1 | [
"MIT"
] | null | null | null | """
Do Not Edit this file. You may and are encouraged to look at it for reference.
"""
import unittest
import dnaSequencing
class TestStrandsAreNotEmpty(unittest.TestCase):
def test001_strandsAreNotEmptyExists(self):
self.assertTrue('strandsAreNotEmpty' in dir(dnaSequencing),
'Func... | 38.193548 | 110 | 0.727196 |
import unittest
import dnaSequencing
class TestStrandsAreNotEmpty(unittest.TestCase):
def test001_strandsAreNotEmptyExists(self):
self.assertTrue('strandsAreNotEmpty' in dir(dnaSequencing),
'Function "strandsAreNotEmpty" was not defined, check your spelling')
def test002_neith... | true | true |
1c324fde2fbe67a02bf54c8152defdcf78ac4408 | 4,082 | py | Python | iconparse.py | avuko/iconparse | 6a5895a26f8a7a43bc365dcadadf53a697f9576d | [
"BSD-3-Clause"
] | null | null | null | iconparse.py | avuko/iconparse | 6a5895a26f8a7a43bc365dcadadf53a697f9576d | [
"BSD-3-Clause"
] | null | null | null | iconparse.py | avuko/iconparse | 6a5895a26f8a7a43bc365dcadadf53a697f9576d | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
import binascii
import sys
import array
# Simple tool to analyse .ico files
# bit = 1, byte = 8, WORD = 16bits, DWORD = 32bits
# 2 hex chars = 1 byte, 8 bits
BYTE = 2
WORD = 4
DWORD = 8
# ICONDIR
# I'll define values as (length in hex chars, default value, name)
# WORD: Reserved (must be 0)
i... | 32.396825 | 75 | 0.632778 | import binascii
import sys
import array
BYTE = 2
WORD = 4
DWORD = 8
# WORD: Reserved (must be 0)
idReserved = {'size': WORD, 'offset': 0, 'name': 'idReserved'}
# WORD: Resource Type (1 for icons)
idType = {'size': WORD, 'offset': 4, 'name': 'idType'}
# WORD: How many images?
idCount = {'size': WORD, 'offset': 8, ... | true | true |
1c3251d213c147a8fb1ad8acb142a4cfc355d157 | 3,889 | py | Python | homeassistant/components/unifi/unifi_entity_base.py | andersop91/core | 0e0ef0aa17073609eae7c974cf4c73306b7c414b | [
"Apache-2.0"
] | 4 | 2021-07-11T09:11:00.000Z | 2022-02-27T14:43:50.000Z | homeassistant/components/unifi/unifi_entity_base.py | andersop91/core | 0e0ef0aa17073609eae7c974cf4c73306b7c414b | [
"Apache-2.0"
] | 277 | 2021-10-04T06:39:33.000Z | 2021-12-28T22:04:17.000Z | homeassistant/components/unifi/unifi_entity_base.py | andersop91/core | 0e0ef0aa17073609eae7c974cf4c73306b7c414b | [
"Apache-2.0"
] | 1 | 2022-01-12T22:14:01.000Z | 2022-01-12T22:14:01.000Z | """Base class for UniFi Network entities."""
import logging
from typing import Any
from homeassistant.core import callback
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity... | 34.114035 | 107 | 0.645153 | import logging
from typing import Any
from homeassistant.core import callback
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
cla... | true | true |
1c32520c22a2a5d88be5c4198d83d778a6ecaf6c | 9,924 | py | Python | train.py | tuq820/efficientdet_with_landmark | 438d92168e5bb91d9ea9bd4b5c743ef41f936fde | [
"MIT"
] | 1 | 2020-07-31T10:04:37.000Z | 2020-07-31T10:04:37.000Z | train.py | tuq820/efficientdet_with_landmark | 438d92168e5bb91d9ea9bd4b5c743ef41f936fde | [
"MIT"
] | null | null | null | train.py | tuq820/efficientdet_with_landmark | 438d92168e5bb91d9ea9bd4b5c743ef41f936fde | [
"MIT"
] | null | null | null | import os
import argparse
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torchvision import transforms
from src.dataset import CocoDataset, Resizer, Normalizer, Augmenter, collater, MaJiaDataset
from src.model import EfficientDet
from tensorboardX import SummaryWriter
import shutil
impo... | 46.373832 | 170 | 0.600665 | import os
import argparse
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torchvision import transforms
from src.dataset import CocoDataset, Resizer, Normalizer, Augmenter, collater, MaJiaDataset
from src.model import EfficientDet
from tensorboardX import SummaryWriter
import shutil
impo... | true | true |
1c3253acb209ec239f44675e6e1fdabe60dfb69e | 8,615 | py | Python | qiskit/circuit/library/__init__.py | saktar-unr/qiskit-terra | e3c4e76957f40ad447e471e64dc101fed418752b | [
"Apache-2.0"
] | null | null | null | qiskit/circuit/library/__init__.py | saktar-unr/qiskit-terra | e3c4e76957f40ad447e471e64dc101fed418752b | [
"Apache-2.0"
] | null | null | null | qiskit/circuit/library/__init__.py | saktar-unr/qiskit-terra | e3c4e76957f40ad447e471e64dc101fed418752b | [
"Apache-2.0"
] | null | null | null | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | 19.988399 | 99 | 0.710157 |
from .standard_gates import *
from .templates import *
from ..barrier import Barrier
from ..measure import Measure
from ..reset import Reset
from .blueprintcircuit import BlueprintCircuit
from .generalized_gates import (
Diagonal,
MCMT,
MCMTVChain,
Permutation,
GMS,
MSGate,
GR,
GRX,
... | true | true |
1c3254b922526c41d4c73273574c98047e8491d8 | 770 | py | Python | Django_Project/apps/oauth/utils.py | yasugsh/Django_Project | de5f5cc9244cc2763dafe7597e5e2efef8342c8a | [
"MIT"
] | null | null | null | Django_Project/apps/oauth/utils.py | yasugsh/Django_Project | de5f5cc9244cc2763dafe7597e5e2efef8342c8a | [
"MIT"
] | null | null | null | Django_Project/apps/oauth/utils.py | yasugsh/Django_Project | de5f5cc9244cc2763dafe7597e5e2efef8342c8a | [
"MIT"
] | null | null | null | from itsdangerous import TimedJSONWebSignatureSerializer as Serializer, BadData
from django.conf import settings
from . import constants
def generate_openid_signature(openid):
"""
对openid进行签名
:param openid: 扫码QQ的openid
:return: 加密后的openid
"""
serializer = Serializer(settings.SECRET_KEY, expi... | 26.551724 | 91 | 0.736364 | from itsdangerous import TimedJSONWebSignatureSerializer as Serializer, BadData
from django.conf import settings
from . import constants
def generate_openid_signature(openid):
serializer = Serializer(settings.SECRET_KEY, expires_in=constants.ACCESS_TOKEN_EXPIRES)
data = {'openid': openid}
token_openid =... | true | true |
1c325586cdeb67523fc28455208f5f446e7a0214 | 37,261 | py | Python | theano/tensor/extra_ops.py | mayunpeng/Theano | c74da33de3768e231ffa0d92d9d11667a2a5aedb | [
"BSD-3-Clause"
] | 1 | 2021-07-01T02:51:08.000Z | 2021-07-01T02:51:08.000Z | theano/tensor/extra_ops.py | mayunpeng/Theano | c74da33de3768e231ffa0d92d9d11667a2a5aedb | [
"BSD-3-Clause"
] | null | null | null | theano/tensor/extra_ops.py | mayunpeng/Theano | c74da33de3768e231ffa0d92d9d11667a2a5aedb | [
"BSD-3-Clause"
] | null | null | null | import numpy as np
import numpy
import warnings
from six.moves import xrange
import theano
from theano.tensor import basic
from theano.tensor import nlinalg # noqa
from theano import gof, scalar
from theano.gradient import DisconnectedType
tensor = basic
class CpuContiguous(theano.Op):
"""
Check to see if t... | 33.997263 | 146 | 0.565524 | import numpy as np
import numpy
import warnings
from six.moves import xrange
import theano
from theano.tensor import basic
from theano.tensor import nlinalg from theano import gof, scalar
from theano.gradient import DisconnectedType
tensor = basic
class CpuContiguous(theano.Op):
__props__ = ()
view_map = {0... | true | true |
1c32567adbefc7506d550909f7d41a6db6224a31 | 2,226 | py | Python | skills_ml/algorithms/sampling/methods.py | maneeshdisodia/skills-ml | 194b262aa5bad1af381d1f63f8b327cf96523950 | [
"MIT"
] | null | null | null | skills_ml/algorithms/sampling/methods.py | maneeshdisodia/skills-ml | 194b262aa5bad1af381d1f63f8b327cf96523950 | [
"MIT"
] | null | null | null | skills_ml/algorithms/sampling/methods.py | maneeshdisodia/skills-ml | 194b262aa5bad1af381d1f63f8b327cf96523950 | [
"MIT"
] | null | null | null | """Generic sampling methods"""
import numpy as np
import heapq as hq
import random
def reservoir(it, k):
"""Reservoir sampling with Random Sort from a job posting iterator
Randomly choosing a sample of k items from a streaming iterator. Using random sort to implement the algorithm.
Basically, it's assigni... | 35.903226 | 119 | 0.623989 | import numpy as np
import heapq as hq
import random
def reservoir(it, k):
it = iter(it)
result = []
for i, datum in enumerate(it):
if i < k:
result.append(datum)
else:
j = random.randint(0, i-1)
if j < k:
result[j] = datum
while len(re... | true | true |
1c32588266235dc67fa6e996a30f2750797e9832 | 876 | py | Python | setup.py | RockefellerArchiveCenter/rac_aspace | 02546e5d618a6b9c2e2edba35383a457cba9321b | [
"MIT"
] | null | null | null | setup.py | RockefellerArchiveCenter/rac_aspace | 02546e5d618a6b9c2e2edba35383a457cba9321b | [
"MIT"
] | 74 | 2020-01-14T14:55:51.000Z | 2021-02-18T21:13:29.000Z | setup.py | RockefellerArchiveCenter/rac_aspace | 02546e5d618a6b9c2e2edba35383a457cba9321b | [
"MIT"
] | 2 | 2020-03-28T21:19:21.000Z | 2022-02-11T20:05:33.000Z | from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(name='rac-aspace',
version='0.0.1',
description='Helpers for using the ArchivesSpace API using ArchivesSnake',
long_description=long_description,
long_description_content_type=... | 35.04 | 80 | 0.590183 | from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(name='rac-aspace',
version='0.0.1',
description='Helpers for using the ArchivesSpace API using ArchivesSnake',
long_description=long_description,
long_description_content_type=... | true | true |
1c32595e7fc90ce0ff461cb9decddd85e1c9ac69 | 3,437 | py | Python | localstack/services/cloudformation/models/logs.py | Madajevas/localstack | 85c712e50d45183b9703c682de02d5114c50c47c | [
"Apache-2.0"
] | 1 | 2022-01-21T17:14:52.000Z | 2022-01-21T17:14:52.000Z | localstack/services/cloudformation/models/logs.py | Madajevas/localstack | 85c712e50d45183b9703c682de02d5114c50c47c | [
"Apache-2.0"
] | null | null | null | localstack/services/cloudformation/models/logs.py | Madajevas/localstack | 85c712e50d45183b9703c682de02d5114c50c47c | [
"Apache-2.0"
] | null | null | null | from localstack.services.cloudformation.deployment_utils import generate_default_name
from localstack.services.cloudformation.service_models import GenericBaseModel
from localstack.utils.aws import aws_stack
class LogsLogGroup(GenericBaseModel):
@staticmethod
def cloudformation_type():
return "AWS::Lo... | 38.188889 | 109 | 0.614489 | from localstack.services.cloudformation.deployment_utils import generate_default_name
from localstack.services.cloudformation.service_models import GenericBaseModel
from localstack.utils.aws import aws_stack
class LogsLogGroup(GenericBaseModel):
@staticmethod
def cloudformation_type():
return "AWS::Lo... | true | true |
1c325ab77c0bd73ccd79c55ec7eed5d45e95eb30 | 4,024 | py | Python | unit_tests/database/ArkDBMySQLTest.py | fangzhouwang/ArkLibPy | e14051eda859ba31887eeb501c27c9d7bf5865c8 | [
"MIT"
] | null | null | null | unit_tests/database/ArkDBMySQLTest.py | fangzhouwang/ArkLibPy | e14051eda859ba31887eeb501c27c9d7bf5865c8 | [
"MIT"
] | null | null | null | unit_tests/database/ArkDBMySQLTest.py | fangzhouwang/ArkLibPy | e14051eda859ba31887eeb501c27c9d7bf5865c8 | [
"MIT"
] | null | null | null | import unittest
from arklibpy.database.ArkDBMySQL import *
from os import path
class ArkDBMySQLTestCase(unittest.TestCase):
def setUp(self):
here = path.abspath(path.dirname(__file__))
self.db_ = ArkDBMySQL(db_config_file=path.join(here, 'db_config_local_tester.txt'))
self.table_ = "test_t... | 49.073171 | 111 | 0.631213 | import unittest
from arklibpy.database.ArkDBMySQL import *
from os import path
class ArkDBMySQLTestCase(unittest.TestCase):
def setUp(self):
here = path.abspath(path.dirname(__file__))
self.db_ = ArkDBMySQL(db_config_file=path.join(here, 'db_config_local_tester.txt'))
self.table_ = "test_t... | true | true |
1c325b46e0e840265cc762067f4583887f37c485 | 993 | py | Python | DataStructures/RingBufferQueue.py | sshh12/SchoolCode | 2b16f0e15d325e01194ce0388bf87eb813ed43e8 | [
"MIT"
] | 5 | 2017-09-26T19:36:51.000Z | 2020-10-01T16:59:07.000Z | DataStructures/RingBufferQueue.py | sshh12/SchoolCode | 2b16f0e15d325e01194ce0388bf87eb813ed43e8 | [
"MIT"
] | 18 | 2017-07-16T20:26:50.000Z | 2018-10-05T20:15:24.000Z | DataStructures/RingBufferQueue.py | sshh12/SchoolCode | 2b16f0e15d325e01194ce0388bf87eb813ed43e8 | [
"MIT"
] | 1 | 2019-04-22T17:38:46.000Z | 2019-04-22T17:38:46.000Z |
class RingBufferQueue:
def __init__(self, size=10):
self.items = [None] * size
self.size = size
self.write_index = 0
self.used = 0
def add(self, item):
if self.used != self.size:
self.items[self.write_index] = item
self.write_index = (self.w... | 16.278689 | 83 | 0.507553 |
class RingBufferQueue:
def __init__(self, size=10):
self.items = [None] * size
self.size = size
self.write_index = 0
self.used = 0
def add(self, item):
if self.used != self.size:
self.items[self.write_index] = item
self.write_index = (self.w... | true | true |
1c325c3597200d10e7f99e53b52661105c29c73c | 382 | py | Python | setup.py | riamf/depsPlot | 0d08e407928301580fbed780b3b22d72222678ad | [
"MIT"
] | null | null | null | setup.py | riamf/depsPlot | 0d08e407928301580fbed780b3b22d72222678ad | [
"MIT"
] | null | null | null | setup.py | riamf/depsPlot | 0d08e407928301580fbed780b3b22d72222678ad | [
"MIT"
] | null | null | null | from setuptools import setup
setup(name='depsPlot',
version='0.1',
description='wip',
url='#',
author='riamf',
author_email='riamf2@gmail.com',
license='MIT',
py_modules=['depsPlot'],
install_requires=[
'Click'
],
entry_points='''
[console_s... | 20.105263 | 38 | 0.536649 | from setuptools import setup
setup(name='depsPlot',
version='0.1',
description='wip',
url='#',
author='riamf',
author_email='riamf2@gmail.com',
license='MIT',
py_modules=['depsPlot'],
install_requires=[
'Click'
],
entry_points='''
[console_s... | true | true |
1c325d919da9763ec1636137e18e475fa5bb6c66 | 2,562 | py | Python | blackswan/pythonanattribution.py | bird-house/blackswan | 5f1f20423874315f5e8eea2cf7302f9d0c05adae | [
"BSD-3-Clause"
] | null | null | null | blackswan/pythonanattribution.py | bird-house/blackswan | 5f1f20423874315f5e8eea2cf7302f9d0c05adae | [
"BSD-3-Clause"
] | 4 | 2018-05-07T16:47:47.000Z | 2019-01-21T13:07:17.000Z | blackswan/pythonanattribution.py | bird-house/blackswan | 5f1f20423874315f5e8eea2cf7302f9d0c05adae | [
"BSD-3-Clause"
] | 2 | 2018-07-10T12:58:55.000Z | 2021-02-13T01:10:52.000Z | # import logging
# LOGGER = logging.getLogger("PYWPS")
import pandas
import random
import numpy as np
def analogs_generator(anafile, yfile, nsim=20):
"""
Simulates nsim values of the variable y using analogues for all the dates present in the file anafile
:param anafile: path to a file with the resu... | 42.7 | 115 | 0.673302 |
import pandas
import random
import numpy as np
def analogs_generator(anafile, yfile, nsim=20):
def weight_analogues(date):
dist = disttable.loc[[date], :].transpose()
date = anatable.loc[[date], :].transpose()
weights = pandas.concat([date.reset_index(drop=True), dist.reset_index(drop=Tr... | true | true |
1c325dbf3e312be52259971858d330435aa51739 | 314 | py | Python | DailyProgrammer/20120221B.py | DayGitH/Python-Challenges | bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf | [
"MIT"
] | 2 | 2020-12-23T18:59:22.000Z | 2021-04-14T13:16:09.000Z | DailyProgrammer/20120221B.py | DayGitH/Python-Challenges | bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf | [
"MIT"
] | null | null | null | DailyProgrammer/20120221B.py | DayGitH/Python-Challenges | bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf | [
"MIT"
] | null | null | null | """
Create a program that will take any string and write it out to a text file, reversed.
input: "hello!"
output: "!olleh"
"""
with open('20120221B.txt', 'w') as f:
f.write(input('Enter string: ')[::-1])
print('DONE')
# found better version
# open('20120221B.txt', 'w').write(input('Enter string: ')[::-1])
| 22.428571 | 85 | 0.640127 |
with open('20120221B.txt', 'w') as f:
f.write(input('Enter string: ')[::-1])
print('DONE')
| true | true |
1c325dcde86abd941f521a970dca3c0e0fb1358e | 407 | py | Python | python/gauss-quadrature.py | simnalamburt/snippets | 8ba4cfcb1305d2b82ea892e3305613eeb7ba382b | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 31 | 2016-01-27T07:03:25.000Z | 2022-02-25T07:59:11.000Z | python/gauss-quadrature.py | simnalamburt/snippets | 8ba4cfcb1305d2b82ea892e3305613eeb7ba382b | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 1 | 2015-01-26T01:27:21.000Z | 2015-01-30T16:16:30.000Z | python/gauss-quadrature.py | simnalamburt/snippets | 8ba4cfcb1305d2b82ea892e3305613eeb7ba382b | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 3 | 2017-02-07T04:17:56.000Z | 2020-06-12T05:01:31.000Z | from decimal import Decimal
from collections.abc import Callable
from math import exp
def gauss_quadrature_3(f: Callable[[Decimal], Decimal]) -> Decimal:
return (
f(Decimal('-0.77459_66692')) * 5/9 +
f(Decimal(0)) * 8/9 +
f(Decimal('+0.77459_66692')) * 5/9
)
print(gauss_quadrature_3(la... | 27.133333 | 67 | 0.646192 | from decimal import Decimal
from collections.abc import Callable
from math import exp
def gauss_quadrature_3(f: Callable[[Decimal], Decimal]) -> Decimal:
return (
f(Decimal('-0.77459_66692')) * 5/9 +
f(Decimal(0)) * 8/9 +
f(Decimal('+0.77459_66692')) * 5/9
)
print(gauss_quadrature_3(la... | true | true |
1c325e83840db2256a5d7fb7eccfe98a622b5b16 | 1,264 | py | Python | var/spack/repos/builtin/packages/tppred/package.py | robertsawko/spack | 135cf4835f5b646c4aaa0e2eb5552c80fc3a5ce8 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 1 | 2019-11-28T10:14:14.000Z | 2019-11-28T10:14:14.000Z | var/spack/repos/builtin/packages/tppred/package.py | robertsawko/spack | 135cf4835f5b646c4aaa0e2eb5552c80fc3a5ce8 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | null | null | null | var/spack/repos/builtin/packages/tppred/package.py | robertsawko/spack | 135cf4835f5b646c4aaa0e2eb5552c80fc3a5ce8 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 1 | 2017-01-21T17:19:32.000Z | 2017-01-21T17:19:32.000Z | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Tppred(Package):
"""TPPRED is a software package for the prediction of mitochondrial
... | 35.111111 | 93 | 0.692247 |
from spack import *
class Tppred(Package):
homepage = "https://tppred2.biocomp.unibo.it/tppred2/default/software"
url = "http://biocomp.unibo.it/savojard/tppred2.tar.gz"
version('2.0', sha256='0e180d5ce1f0bccfdbc3dbf9981b3fbe2101c85491c58c58c88856861688a4f5')
depends_on('python@2.7:2.999', ty... | true | true |
1c325fed87fbaa63dee2d08b90932038e5391f92 | 473 | py | Python | 9.11/tor/model_lstm_crf/config.py | JIAQING-XIE/Google_NLP_DL | 45f45e8cbca695ad079af58790edd0619783b0c2 | [
"MIT"
] | null | null | null | 9.11/tor/model_lstm_crf/config.py | JIAQING-XIE/Google_NLP_DL | 45f45e8cbca695ad079af58790edd0619783b0c2 | [
"MIT"
] | null | null | null | 9.11/tor/model_lstm_crf/config.py | JIAQING-XIE/Google_NLP_DL | 45f45e8cbca695ad079af58790edd0619783b0c2 | [
"MIT"
] | null | null | null | batch_size = 8
learning_rate = 0.001
decay_rate = 0.05
seed = 1314159
np_seed = 7894
embedding_size = 300
classfy_number = 13
dropout = 0.5
lstm_hidding_dim = 50
max_length = 83
labels_dict = {
'O':0,'B-POS':1,'I-POS':2,'E-POS':3,'S-POS':4,'B-NEG':5,'I-NEG':6,'E-NEG':7,'S-NEG':8,'B-NEU':9,
'I-NEU':10,'E-NEU':1... | 29.5625 | 118 | 0.610994 | batch_size = 8
learning_rate = 0.001
decay_rate = 0.05
seed = 1314159
np_seed = 7894
embedding_size = 300
classfy_number = 13
dropout = 0.5
lstm_hidding_dim = 50
max_length = 83
labels_dict = {
'O':0,'B-POS':1,'I-POS':2,'E-POS':3,'S-POS':4,'B-NEG':5,'I-NEG':6,'E-NEG':7,'S-NEG':8,'B-NEU':9,
'I-NEU':10,'E-NEU':1... | true | true |
1c32608743780b5486438bd3700e3575a16a1d5a | 8,789 | py | Python | kohtaaminen/kohtaaminen.py | sthagen/kohtaaminen | ce0784ccd8be109164d63f2b5dcea128bd6f4534 | [
"MIT"
] | 1 | 2021-11-13T10:57:55.000Z | 2021-11-13T10:57:55.000Z | kohtaaminen/kohtaaminen.py | sthagen/kohtaaminen | ce0784ccd8be109164d63f2b5dcea128bd6f4534 | [
"MIT"
] | 4 | 2021-11-14T15:12:06.000Z | 2021-11-30T13:54:47.000Z | kohtaaminen/kohtaaminen.py | sthagen/kohtaaminen | ce0784ccd8be109164d63f2b5dcea128bd6f4534 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# pylint: disable=expression-not-assigned,line-too-long
"""Meeting, rendezvous, confluence (Finnish kohtaaminen) mark up, down, and up again. API."""
import itertools
import os
import pathlib
import re
import shutil
import sys
import tempfile
import zipfile
from typing import List, Optional, Tup... | 38.718062 | 119 | 0.544203 | import itertools
import os
import pathlib
import re
import shutil
import sys
import tempfile
import zipfile
from typing import List, Optional, Tuple, Union
import mdformat
import pypandoc
DEBUG_VAR = 'KOHTAAMINEN_DEBUG'
DEBUG = os.getenv(DEBUG_VAR)
ENCODING = 'utf-8'
ENCODING_ERRORS_POLICY = 'ignore'
STDIN, STDOUT... | true | true |
1c3260c0e2eecca41e5e9561c9a6cc46d9880888 | 397 | py | Python | app/Images_DRF/wsgi.py | MateuszZalewski/images_drf | 8e4b3012ef6bce290d013db9c2318d1badb99b17 | [
"MIT"
] | null | null | null | app/Images_DRF/wsgi.py | MateuszZalewski/images_drf | 8e4b3012ef6bce290d013db9c2318d1badb99b17 | [
"MIT"
] | null | null | null | app/Images_DRF/wsgi.py | MateuszZalewski/images_drf | 8e4b3012ef6bce290d013db9c2318d1badb99b17 | [
"MIT"
] | null | null | null | """
WSGI config for Images_DRF project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SE... | 23.352941 | 78 | 0.788413 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Images_DRF.settings')
application = get_wsgi_application()
| true | true |
1c3260f34fa9e0aad04e8d0bc77a99f301bb1242 | 933 | py | Python | sentsplit/regexes.py | zaemyung/sentsplit | cce34e1ed372b6a79c739f42334c775581fc0de8 | [
"MIT"
] | 10 | 2021-03-26T19:34:45.000Z | 2021-11-23T17:36:45.000Z | sentsplit/regexes.py | zaemyung/sentsplit | cce34e1ed372b6a79c739f42334c775581fc0de8 | [
"MIT"
] | 10 | 2021-03-26T17:27:49.000Z | 2021-11-16T17:09:19.000Z | sentsplit/regexes.py | zaemyung/sentsplit | cce34e1ed372b6a79c739f42334c775581fc0de8 | [
"MIT"
] | null | null | null | """
`segment_regexes`: make sure a string is segmented at either the start or end of the matching group(s)
"""
newline = {
'name': 'newline',
'regex': r'\n',
'at': 'end'
}
ellipsis = {
'name': 'ellipsis',
'regex': r'…(?![\!\?\..?!])',
'at': 'end'
}
after_semicolon = {
'name': 'after_semico... | 25.916667 | 225 | 0.487674 | newline = {
'name': 'newline',
'regex': r'\n',
'at': 'end'
}
ellipsis = {
'name': 'ellipsis',
'regex': r'…(?![\!\?\..?!])',
'at': 'end'
}
after_semicolon = {
'name': 'after_semicolon',
'regex': r' *;',
'at': 'end'
}
liberal_url = {
'name': 'liberal_url',
'regex': r'\b... | true | true |
1c3261fa9f8dfffa8f5f181f97cefb2281e6fd79 | 13,511 | py | Python | al_utils/vae_sampling.py | PrateekMunjal/TorchAL | ec60b093333c66e4c8862d128d81680060fddf36 | [
"MIT"
] | null | null | null | al_utils/vae_sampling.py | PrateekMunjal/TorchAL | ec60b093333c66e4c8862d128d81680060fddf36 | [
"MIT"
] | null | null | null | al_utils/vae_sampling.py | PrateekMunjal/TorchAL | ec60b093333c66e4c8862d128d81680060fddf36 | [
"MIT"
] | null | null | null | import torch
import os
import math
import numpy as np
from copy import deepcopy
from pycls.core.config import cfg
import pycls.utils.distributed as du
from tqdm import tqdm
class AdversarySampler:
def __init__(self, budget):
self.budget = budget
self.cuda_id = torch.cuda.current_device()
def ... | 35.36911 | 136 | 0.595589 | import torch
import os
import math
import numpy as np
from copy import deepcopy
from pycls.core.config import cfg
import pycls.utils.distributed as du
from tqdm import tqdm
class AdversarySampler:
def __init__(self, budget):
self.budget = budget
self.cuda_id = torch.cuda.current_device()
def ... | true | true |
1c326417f077d789ca1b7eb5a188712ad78f5c31 | 1,986 | py | Python | src/metabase_manager/registry.py | chasleslr/metabase-manager | 091d2146d08850f2020a3c8b1d23f8deb5dce888 | [
"MIT"
] | null | null | null | src/metabase_manager/registry.py | chasleslr/metabase-manager | 091d2146d08850f2020a3c8b1d23f8deb5dce888 | [
"MIT"
] | 19 | 2022-03-05T02:03:45.000Z | 2022-03-21T03:02:06.000Z | src/metabase_manager/registry.py | chasleslr/metabase-manager | 091d2146d08850f2020a3c8b1d23f8deb5dce888 | [
"MIT"
] | null | null | null | from dataclasses import dataclass, field
from typing import List, Optional, Type
import metabase
from metabase import (
Database,
Field,
Metabase,
Metric,
PermissionGroup,
Segment,
Table,
User,
)
from metabase.resource import Resource
from metabase_manager.exceptions import DuplicateKe... | 29.205882 | 81 | 0.646526 | from dataclasses import dataclass, field
from typing import List, Optional, Type
import metabase
from metabase import (
Database,
Field,
Metabase,
Metric,
PermissionGroup,
Segment,
Table,
User,
)
from metabase.resource import Resource
from metabase_manager.exceptions import DuplicateKe... | true | true |
1c3264d05fa3133a8547727b7c7c279a53e36aba | 219 | py | Python | backend/views/meta.py | TeamAutoMod/AutoMod | 5934881c7bb71ba17c8e40e11c6fd2bcfad7ae50 | [
"MIT"
] | 13 | 2021-09-29T13:08:23.000Z | 2022-03-21T20:59:27.000Z | backend/views/meta.py | TeamAutoMod/AutoMod | 5934881c7bb71ba17c8e40e11c6fd2bcfad7ae50 | [
"MIT"
] | null | null | null | backend/views/meta.py | TeamAutoMod/AutoMod | 5934881c7bb71ba17c8e40e11c6fd2bcfad7ae50 | [
"MIT"
] | 7 | 2021-09-26T19:10:47.000Z | 2022-03-26T11:27:11.000Z | import discord
from discord.ui import View
from .buttons import DeleteBtn
class DeleteView(View):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.add_item(DeleteBtn()) | 19.909091 | 41 | 0.684932 | import discord
from discord.ui import View
from .buttons import DeleteBtn
class DeleteView(View):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.add_item(DeleteBtn()) | true | true |
1c32653de6c0dc6659fc5d9ed3f6ce46cdd2ed42 | 2,067 | py | Python | data/test/python/1c32653de6c0dc6659fc5d9ed3f6ce46cdd2ed42market_v4.py | harshp8l/deep-learning-lang-detection | 2a54293181c1c2b1a2b840ddee4d4d80177efb33 | [
"MIT"
] | 84 | 2017-10-25T15:49:21.000Z | 2021-11-28T21:25:54.000Z | data/test/python/1c32653de6c0dc6659fc5d9ed3f6ce46cdd2ed42market_v4.py | vassalos/deep-learning-lang-detection | cbb00b3e81bed3a64553f9c6aa6138b2511e544e | [
"MIT"
] | 5 | 2018-03-29T11:50:46.000Z | 2021-04-26T13:33:18.000Z | data/test/python/1c32653de6c0dc6659fc5d9ed3f6ce46cdd2ed42market_v4.py | vassalos/deep-learning-lang-detection | cbb00b3e81bed3a64553f9c6aa6138b2511e544e | [
"MIT"
] | 24 | 2017-11-22T08:31:00.000Z | 2022-03-27T01:22:31.000Z | from __future__ import print_function
from multiprocessing import Process
import zmq
import itertools
from lib import *
import Queue
context = zmq.Context()
from traders import Trader
from brokers import JobQueueBroker
from workers import AuthWorker, DBWorker
from time import sleep
AddressManager.register_endpoint('... | 31.8 | 134 | 0.734398 | from __future__ import print_function
from multiprocessing import Process
import zmq
import itertools
from lib import *
import Queue
context = zmq.Context()
from traders import Trader
from brokers import JobQueueBroker
from workers import AuthWorker, DBWorker
from time import sleep
AddressManager.register_endpoint('... | true | true |
1c32658d8f2697e42b6d3d48d7586f3159a5887a | 117 | py | Python | Part 1/Chapter 10/exercise_10.11a.py | kg55555/pypractice | 1867f001b3d2a7174ea00d7b9e2fa22e9f1877ef | [
"MIT"
] | null | null | null | Part 1/Chapter 10/exercise_10.11a.py | kg55555/pypractice | 1867f001b3d2a7174ea00d7b9e2fa22e9f1877ef | [
"MIT"
] | null | null | null | Part 1/Chapter 10/exercise_10.11a.py | kg55555/pypractice | 1867f001b3d2a7174ea00d7b9e2fa22e9f1877ef | [
"MIT"
] | null | null | null | import json
fav = input("What is your favourite number?\n")
with open('r_fav', 'w') as fn:
json.dump(fav, fn)
| 14.625 | 47 | 0.641026 | import json
fav = input("What is your favourite number?\n")
with open('r_fav', 'w') as fn:
json.dump(fav, fn)
| true | true |
1c326597414a341be5f886a62626944c3c0b78dc | 1,879 | py | Python | apolloMusicRipper/run.py | ebber/apolloRipper | 863789229639036c5d4bc0d021b9cef0c8c41167 | [
"MIT"
] | null | null | null | apolloMusicRipper/run.py | ebber/apolloRipper | 863789229639036c5d4bc0d021b9cef0c8c41167 | [
"MIT"
] | null | null | null | apolloMusicRipper/run.py | ebber/apolloRipper | 863789229639036c5d4bc0d021b9cef0c8c41167 | [
"MIT"
] | null | null | null | import os
import config
from ripper.ytRipper import Ripper
from model.song import Song
from tagging.tagger import Tagger
import logging
tagger = Tagger()
ripper = Ripper()
notDone = True
logger = logging.getLogger("mainLoopLogger")
#goes through all songs in the directory, calls tagFile
def tagDir(dir=config.DIR_UNT... | 27.632353 | 79 | 0.625865 | import os
import config
from ripper.ytRipper import Ripper
from model.song import Song
from tagging.tagger import Tagger
import logging
tagger = Tagger()
ripper = Ripper()
notDone = True
logger = logging.getLogger("mainLoopLogger")
def tagDir(dir=config.DIR_UNTAGGED):
logger.info("tagging songs in "+dir)
for... | true | true |
1c3265c5e63e7d32d1a24668a6009ee611fd3470 | 1,086 | py | Python | similarity/discursos_separados_em_json.py | Oguiraw/Me-diz-quem-tu-es | 66d2d79f789f112f70f81d38fed57e3a9c87be86 | [
"MIT"
] | null | null | null | similarity/discursos_separados_em_json.py | Oguiraw/Me-diz-quem-tu-es | 66d2d79f789f112f70f81d38fed57e3a9c87be86 | [
"MIT"
] | null | null | null | similarity/discursos_separados_em_json.py | Oguiraw/Me-diz-quem-tu-es | 66d2d79f789f112f70f81d38fed57e3a9c87be86 | [
"MIT"
] | 1 | 2018-12-19T16:21:55.000Z | 2018-12-19T16:21:55.000Z | import gensim, nltk, re, json, os
from gensim import corpora,similarities, models
from nltk.tokenize import word_tokenize
from datetime import date,datetime
import csv
import base64
from sklearn.cluster import k_means
import numpy as np
csv.field_size_limit(100000000)
def open_file(name_file,data):
with open(name... | 27.15 | 72 | 0.631676 | import gensim, nltk, re, json, os
from gensim import corpora,similarities, models
from nltk.tokenize import word_tokenize
from datetime import date,datetime
import csv
import base64
from sklearn.cluster import k_means
import numpy as np
csv.field_size_limit(100000000)
def open_file(name_file,data):
with open(name... | true | true |
1c3266a4c989d03da9f5adcb2e5b18de48ce8374 | 5,878 | py | Python | ManageOrdersS3.py | jorgeMorfinezM/AwsS3FileManager | 443800c58371391b8c127ed538c21766b2315eac | [
"Apache-2.0"
] | 1 | 2020-08-13T21:28:19.000Z | 2020-08-13T21:28:19.000Z | ManageOrdersS3.py | jorgeMorfinezM/AwsS3FileManager | 443800c58371391b8c127ed538c21766b2315eac | [
"Apache-2.0"
] | null | null | null | ManageOrdersS3.py | jorgeMorfinezM/AwsS3FileManager | 443800c58371391b8c127ed538c21766b2315eac | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Requires Python 3.6 or later
"""
__author__ = "Jorge Morfinez Mojica (jorge.morfinez.m@gmail.com)"
__copyright__ = "Copyright 2020, Jorge Morfinez Mojica"
__license__ = ""
__history__ = """ Se conecta, valida y copia
documentos/archivos a un
Bucket de A... | 27.85782 | 102 | 0.652943 |
__author__ = "Jorge Morfinez Mojica (jorge.morfinez.m@gmail.com)"
__copyright__ = "Copyright 2020, Jorge Morfinez Mojica"
__license__ = ""
__history__ = """ Se conecta, valida y copia
documentos/archivos a un
Bucket de AWS S3 a partir
de un directorio local."""
... | true | true |
1c3266af38e628e6e69888ae24ffb3ecb5af0766 | 1,717 | py | Python | CodeGenX64/isel_tester.py | robertmuth/Cwerg | fdf30b06c93b4620c0a45b448b6d92acb81c35f0 | [
"Apache-2.0"
] | 171 | 2020-01-30T16:58:07.000Z | 2022-03-27T22:12:17.000Z | CodeGenX64/isel_tester.py | robertmuth/Cwerg | fdf30b06c93b4620c0a45b448b6d92acb81c35f0 | [
"Apache-2.0"
] | 14 | 2021-05-15T02:12:09.000Z | 2022-03-16T04:16:18.000Z | CodeGenX64/isel_tester.py | robertmuth/Cwerg | fdf30b06c93b4620c0a45b448b6d92acb81c35f0 | [
"Apache-2.0"
] | 5 | 2021-03-01T20:52:13.000Z | 2022-03-07T06:35:03.000Z | #!/usr/bin/python3
"""Testing helper for table driven code selection"""
from CpuX64 import symbolic
from Base import serialize
from Base import ir
from CodeGenX64 import isel_tab
from CodeGenX64 import regs
from typing import Any
import sys
def OpToStr(op: Any) -> str:
return str(op)
def OpTypeStr(op: Any) ->... | 27.693548 | 77 | 0.627257 |
from CpuX64 import symbolic
from Base import serialize
from Base import ir
from CodeGenX64 import isel_tab
from CodeGenX64 import regs
from typing import Any
import sys
def OpToStr(op: Any) -> str:
return str(op)
def OpTypeStr(op: Any) -> str:
if isinstance(op, ir.Reg):
return op.kind.name
eli... | true | true |
1c3266af66ce2cbcce02c1fab886491c7e384cea | 2,607 | py | Python | aedes_server/core/models.py | henriquenogueira/aedes | 43b8376a091c57dd45d342dea78301c0a79b5df0 | [
"MIT"
] | null | null | null | aedes_server/core/models.py | henriquenogueira/aedes | 43b8376a091c57dd45d342dea78301c0a79b5df0 | [
"MIT"
] | 8 | 2016-03-27T03:15:42.000Z | 2016-03-28T23:59:55.000Z | aedes_server/core/models.py | henriquenogueira/aedes | 43b8376a091c57dd45d342dea78301c0a79b5df0 | [
"MIT"
] | null | null | null | from django.db import models
class Report(models.Model):
'''
Model that represents a given report by an user.
It contains information about the location of
the report as well as the type and timestamp.
'''
REPORT_CATEGORIES = (
('F', 'Foco'), # Represents a potential place where aede... | 38.910448 | 99 | 0.666667 | from django.db import models
class Report(models.Model):
REPORT_CATEGORIES = (
('F', 'Foco'), ('C', 'Criadouro'), ('SD', 'Suspeita de dengue'), # Someone near feeling symptoms of dengue
('SZ', 'Suspeita de zika'), # Someone near feeling symptoms of zika
('SC', 'Suspeit... | true | true |
1c32683d609fb544f45af4fd713ee418abb2c7ad | 3,311 | py | Python | example/dj/apps/test_chamber/tests/models/dispatchers.py | rubickcz/django-chamber | 0b4c51c66e0f496c6ebdbf4130bab8dd2fc53984 | [
"BSD-3-Clause"
] | null | null | null | example/dj/apps/test_chamber/tests/models/dispatchers.py | rubickcz/django-chamber | 0b4c51c66e0f496c6ebdbf4130bab8dd2fc53984 | [
"BSD-3-Clause"
] | null | null | null | example/dj/apps/test_chamber/tests/models/dispatchers.py | rubickcz/django-chamber | 0b4c51c66e0f496c6ebdbf4130bab8dd2fc53984 | [
"BSD-3-Clause"
] | null | null | null | from nose.tools import raises # pylint: disable=E0401
from django.core.exceptions import ImproperlyConfigured
from django.test import TransactionTestCase
from chamber.models.dispatchers import BaseDispatcher, StateDispatcher
from chamber.shortcuts import change_and_save
from chamber.utils.transaction import transact... | 45.986111 | 109 | 0.749018 | from nose.tools import raises
from django.core.exceptions import ImproperlyConfigured
from django.test import TransactionTestCase
from chamber.models.dispatchers import BaseDispatcher, StateDispatcher
from chamber.shortcuts import change_and_save
from chamber.utils.transaction import transaction_signals
from german... | true | true |
1c3269d2b4f3191e5d18f00db8deca25f16330f6 | 2,748 | py | Python | fairml/metrics/utils.py | SchernHe/FairML | ebd32df6dec1d5232e05e18c88e89179a420659e | [
"MIT"
] | null | null | null | fairml/metrics/utils.py | SchernHe/FairML | ebd32df6dec1d5232e05e18c88e89179a420659e | [
"MIT"
] | null | null | null | fairml/metrics/utils.py | SchernHe/FairML | ebd32df6dec1d5232e05e18c88e89179a420659e | [
"MIT"
] | null | null | null | """Provides useful functions to calculate fairness metrics"""
from sklearn.metrics import confusion_matrix, accuracy_score, precision_score
import numpy as np
import pandas as pd
def calculate_precision(df, target_variable, prediction_variable):
"""Calculate precision / positive predictive value PPV"""
tn, fp... | 28.329897 | 86 | 0.654294 | from sklearn.metrics import confusion_matrix, accuracy_score, precision_score
import numpy as np
import pandas as pd
def calculate_precision(df, target_variable, prediction_variable):
tn, fp, fn, tp = confusion_matrix(
df[target_variable], df[prediction_variable]
).ravel()
if (tp + fp) != 0:
... | true | true |
1c326a10a08831667792f3baae827a68ee85eae2 | 32,426 | py | Python | metalcode_v1_0.py | mpiecka/metalcode | b0306dc9d8de53d797c946254fa63fa8b3fbf093 | [
"MIT"
] | 1 | 2021-12-13T17:20:44.000Z | 2021-12-13T17:20:44.000Z | metalcode_v1_0.py | mpiecka/metalcode | b0306dc9d8de53d797c946254fa63fa8b3fbf093 | [
"MIT"
] | null | null | null | metalcode_v1_0.py | mpiecka/metalcode | b0306dc9d8de53d797c946254fa63fa8b3fbf093 | [
"MIT"
] | null | null | null | from numpy import *
import matplotlib.pyplot as plt
import time
import os
import warnings
warnings.filterwarnings("ignore", category=VisibleDeprecationWarning)
# from metalcode_calib_metal import metal_transf
from metalcode_calib_tempe import Teff
from metalcode_calib_tempe import BolCorBV
from metalcode_cal... | 44.541209 | 570 | 0.554833 | from numpy import *
import matplotlib.pyplot as plt
import time
import os
import warnings
warnings.filterwarnings("ignore", category=VisibleDeprecationWarning)
from metalcode_calib_tempe import Teff
from metalcode_calib_tempe import BolCorBV
from metalcode_calib_absmg import absmag
from metalcode_calib_clrex... | true | true |
1c326c1be1fa65ae94e336626f666e99c0ffbc37 | 2,281 | py | Python | dialogue-engine/test/programytest/parser/template/graph_tests/test_program.py | cotobadesign/cotoba-agent-oss | 3833d56e79dcd7529c3e8b3a3a8a782d513d9b12 | [
"MIT"
] | 104 | 2020-03-30T09:40:00.000Z | 2022-03-06T22:34:25.000Z | dialogue-engine/test/programytest/parser/template/graph_tests/test_program.py | cotobadesign/cotoba-agent-oss | 3833d56e79dcd7529c3e8b3a3a8a782d513d9b12 | [
"MIT"
] | 25 | 2020-06-12T01:36:35.000Z | 2022-02-19T07:30:44.000Z | dialogue-engine/test/programytest/parser/template/graph_tests/test_program.py | cotobadesign/cotoba-agent-oss | 3833d56e79dcd7529c3e8b3a3a8a782d513d9b12 | [
"MIT"
] | 10 | 2020-04-02T23:43:56.000Z | 2021-05-14T13:47:01.000Z | """
Copyright (c) 2020 COTOBA DESIGN, Inc.
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, distri... | 44.72549 | 126 | 0.737396 | import xml.etree.ElementTree as ET
from programy.parser.template.nodes.base import TemplateNode
from programy.parser.template.nodes.program import TemplateProgramNode
from programy.parser.exceptions import ParserException
from programytest.parser.template.graph_tests.graph_test_client import TemplateGraphTestClient
... | true | true |
1c326c78d52342aca0f9514217bc8d7c8987413f | 685 | py | Python | ynab_sdk/api/accounts.py | csadorf/ynab-sdk-python | 845d3798e44bbc27261f73975089d8e19366e8e8 | [
"Apache-2.0"
] | 19 | 2019-05-04T00:26:31.000Z | 2021-09-01T07:31:20.000Z | ynab_sdk/api/accounts.py | csadorf/ynab-sdk-python | 845d3798e44bbc27261f73975089d8e19366e8e8 | [
"Apache-2.0"
] | 100 | 2019-04-25T00:27:57.000Z | 2022-03-31T15:24:45.000Z | ynab_sdk/api/accounts.py | csadorf/ynab-sdk-python | 845d3798e44bbc27261f73975089d8e19366e8e8 | [
"Apache-2.0"
] | 7 | 2019-11-13T06:30:06.000Z | 2022-03-25T15:37:53.000Z | from ynab_sdk.api.models.responses.account import AccountResponse
from ynab_sdk.api.models.responses.accounts import AccountsResponse
from ynab_sdk.utils.clients.base_client import BaseClient
class AccountsApi:
def __init__(self, client: BaseClient):
self.client = client
def get_accounts(self, budget... | 40.294118 | 81 | 0.753285 | from ynab_sdk.api.models.responses.account import AccountResponse
from ynab_sdk.api.models.responses.accounts import AccountsResponse
from ynab_sdk.utils.clients.base_client import BaseClient
class AccountsApi:
def __init__(self, client: BaseClient):
self.client = client
def get_accounts(self, budget... | true | true |
1c326d2cf6bfa0dfe105f44ccdd7ffff3833f586 | 8,432 | py | Python | Part2/build_model.py | KernelA/ai-lab-test | 3dda3d7879ec77a37fd70be3da8d92cf0a74321c | [
"MIT"
] | null | null | null | Part2/build_model.py | KernelA/ai-lab-test | 3dda3d7879ec77a37fd70be3da8d92cf0a74321c | [
"MIT"
] | null | null | null | Part2/build_model.py | KernelA/ai-lab-test | 3dda3d7879ec77a37fd70be3da8d92cf0a74321c | [
"MIT"
] | null | null | null | import gzip
import json
import logging
import os
import pickle
import re
import string
import unicodedata
import sys
from typing import Dict, Any
from nltk.tokenize import TweetTokenizer
LOGGER = logging.getLogger()
LOGGER.setLevel(logging.DEBUG)
FORMAT = "%(asctime)s %(name)s [%(levelname)s] {%(funcName)s} %(messag... | 35.280335 | 129 | 0.603534 | import gzip
import json
import logging
import os
import pickle
import re
import string
import unicodedata
import sys
from typing import Dict, Any
from nltk.tokenize import TweetTokenizer
LOGGER = logging.getLogger()
LOGGER.setLevel(logging.DEBUG)
FORMAT = "%(asctime)s %(name)s [%(levelname)s] {%(funcName)s} %(messag... | true | true |
1c326d45a20d612aabe7081c9482a2bf8c5d9ead | 377 | py | Python | mainApp/migrations/0008_auto_20191221_1544.py | GauravJain98/Softwars | 10625a90599f834f785a64586bd736dec84fd25b | [
"MIT"
] | null | null | null | mainApp/migrations/0008_auto_20191221_1544.py | GauravJain98/Softwars | 10625a90599f834f785a64586bd736dec84fd25b | [
"MIT"
] | 5 | 2021-03-19T12:47:20.000Z | 2021-09-22T19:42:53.000Z | mainApp/migrations/0008_auto_20191221_1544.py | GauravJain98/Softwars | 10625a90599f834f785a64586bd736dec84fd25b | [
"MIT"
] | null | null | null | # Generated by Django 3.0 on 2019-12-21 15:44
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mainApp', '0007_auto_20191215_2009'),
]
operations = [
migrations.RenameField(
model_name='problemstatement',
old_name='youtube... | 20.944444 | 47 | 0.604775 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mainApp', '0007_auto_20191215_2009'),
]
operations = [
migrations.RenameField(
model_name='problemstatement',
old_name='youtube_link',
new_name='youtube',
... | true | true |
1c326e4b8b37ac6f1f9cb4aae8e43bdf93dddc0a | 642 | py | Python | multiProcess/threads/multilock1.py | bruce1408/detectron2_modify | 815df8c3cd68b1450e039fbafc27c6ab302d620b | [
"Apache-2.0"
] | null | null | null | multiProcess/threads/multilock1.py | bruce1408/detectron2_modify | 815df8c3cd68b1450e039fbafc27c6ab302d620b | [
"Apache-2.0"
] | null | null | null | multiProcess/threads/multilock1.py | bruce1408/detectron2_modify | 815df8c3cd68b1450e039fbafc27c6ab302d620b | [
"Apache-2.0"
] | null | null | null | import threading
import time
num = 100
def fun_sub():
global num
lock.acquire()
print('----加锁----')
print('现在操作共享资源的线程名字是:', t.name)
num2 = num
time.sleep(0.001)
num = num2-1
lock.release()
print('----释放锁----')
if __name__ == '__main__':
print('开始测试同步锁 at %s' % time.ctime())... | 18.882353 | 44 | 0.565421 | import threading
import time
num = 100
def fun_sub():
global num
lock.acquire()
print('----加锁----')
print('现在操作共享资源的线程名字是:', t.name)
num2 = num
time.sleep(0.001)
num = num2-1
lock.release()
print('----释放锁----')
if __name__ == '__main__':
print('开始测试同步锁 at %s' % time.ctime())... | true | true |
1c32706216a59ee6d52a4376463befff7c87cc1c | 1,286 | py | Python | test_app.py | MLH-Fellowship/0.5.1-howDoIDiscord | 5bb52e17635f6742dbccd8044435dddd82a3bb93 | [
"MIT"
] | 2 | 2020-06-05T17:31:17.000Z | 2020-06-05T21:32:48.000Z | test_app.py | MLH-Fellowship/0.5.1-howDoIDiscord | 5bb52e17635f6742dbccd8044435dddd82a3bb93 | [
"MIT"
] | 13 | 2020-06-02T15:34:43.000Z | 2020-06-23T23:25:25.000Z | test_app.py | MLH-Fellowship/0.5.1-howDoIDiscord | 5bb52e17635f6742dbccd8044435dddd82a3bb93 | [
"MIT"
] | null | null | null | import pytest
import requests
import json
import urllib.parse
import subprocess
def callHowDoI(testQuery):
# x = requests.post("http://localhost:5000/test", params={"testquery": testQuery})
cmd = "http -f POST http://localhost:5000/test?testquery={}".format(urllib.parse.quote(testQuery))
res = subprocess.c... | 34.756757 | 102 | 0.618974 | import pytest
import requests
import json
import urllib.parse
import subprocess
def callHowDoI(testQuery):
cmd = "http -f POST http://localhost:5000/test?testquery={}".format(urllib.parse.quote(testQuery))
res = subprocess.check_output(cmd, shell=True)
res = res.decode('utf-8')
jsonRes = json.l... | true | true |
1c3270da277a227601ccd6d01a1407d95545ca58 | 1,842 | py | Python | PygameDeepRLAgent/A3CBootcampGame/ShootingGrounds/Targets.py | Muff1nz/PygameDeepRLAgent | c3e53de99ff847357e27048843ea01fe92fbfd38 | [
"MIT"
] | null | null | null | PygameDeepRLAgent/A3CBootcampGame/ShootingGrounds/Targets.py | Muff1nz/PygameDeepRLAgent | c3e53de99ff847357e27048843ea01fe92fbfd38 | [
"MIT"
] | 4 | 2017-08-25T08:54:05.000Z | 2017-10-26T09:15:18.000Z | PygameDeepRLAgent/A3CBootcampGame/ShootingGrounds/Targets.py | Muff1nz/PygameDeepRLAgent | c3e53de99ff847357e27048843ea01fe92fbfd38 | [
"MIT"
] | 1 | 2019-12-10T01:11:41.000Z | 2019-12-10T01:11:41.000Z | import random
import numpy as np
from A3CBootcampGame.Actor import Actor
class TargetHandler:
def __init__(self, settings, player):
self.settings = settings
self.player = player
self.target = Target(settings, [0,0], "./Assets/Enemy.png")
self.foodSpawnRate = 30
self.spawn... | 28.338462 | 84 | 0.582519 | import random
import numpy as np
from A3CBootcampGame.Actor import Actor
class TargetHandler:
def __init__(self, settings, player):
self.settings = settings
self.player = player
self.target = Target(settings, [0,0], "./Assets/Enemy.png")
self.foodSpawnRate = 30
self.spawn... | true | true |
1c3272ddf3297908c116e0893bea7b92b2baba48 | 743 | py | Python | pzdump.py | kavol/pzdump | 2e7c57a304b7ad2780aff26b26a710634622dfb8 | [
"MIT"
] | null | null | null | pzdump.py | kavol/pzdump | 2e7c57a304b7ad2780aff26b26a710634622dfb8 | [
"MIT"
] | null | null | null | pzdump.py | kavol/pzdump | 2e7c57a304b7ad2780aff26b26a710634622dfb8 | [
"MIT"
] | null | null | null | #!/usr/bin/python
import argparse
import sys
parser = argparse.ArgumentParser(description="A tool to dump timezone data.")
parser.add_argument("-V", "--version", help="output version information and exit",
action="store_true")
parser.add_argument("-v", "--verbose", help="print lowest and highest p... | 35.380952 | 110 | 0.644684 |
import argparse
import sys
parser = argparse.ArgumentParser(description="A tool to dump timezone data.")
parser.add_argument("-V", "--version", help="output version information and exit",
action="store_true")
parser.add_argument("-v", "--verbose", help="print lowest and highest possible time and t... | true | true |
1c32733ec0f61da2f97776ffd0055187cdc56853 | 146 | py | Python | yc66/104.py | c-yan/yukicoder | cdbbd65402177225dd989df7fe01f67908484a69 | [
"MIT"
] | null | null | null | yc66/104.py | c-yan/yukicoder | cdbbd65402177225dd989df7fe01f67908484a69 | [
"MIT"
] | null | null | null | yc66/104.py | c-yan/yukicoder | cdbbd65402177225dd989df7fe01f67908484a69 | [
"MIT"
] | null | null | null | S = input()
result = 1
for s in S:
if s == 'L':
result = result * 2
elif s == 'R':
result = result * 2 + 1
print(result)
| 14.6 | 31 | 0.465753 | S = input()
result = 1
for s in S:
if s == 'L':
result = result * 2
elif s == 'R':
result = result * 2 + 1
print(result)
| true | true |
1c3273449f87ead7feafe7ed121958c401918fa7 | 7,903 | py | Python | model.py | haoyu0831/Covid-Mobility-Network-Analysis | 8464b0a25db03585219c1fc6d8e257a9ed826628 | [
"MIT"
] | 1 | 2020-09-23T06:08:20.000Z | 2020-09-23T06:08:20.000Z | model.py | hhe-bot/Covid-Mobility-Network-Analysis | 8464b0a25db03585219c1fc6d8e257a9ed826628 | [
"MIT"
] | 1 | 2020-09-23T06:10:29.000Z | 2020-09-25T15:41:33.000Z | model.py | haoyu0831/Covid-Mobility-Network-Analysis | 8464b0a25db03585219c1fc6d8e257a9ed826628 | [
"MIT"
] | null | null | null | import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
'''
This function is to generate a graph with data produced by read_file.py
'''
def generate_d_network(dest_cbgs):
G = nx.DiGraph()
# add edges
for i in dest_cbgs:
G.add_edge(*i, weight=dest_cbgs[i])
return G
'''
Thi... | 23.520833 | 137 | 0.592307 | import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
def generate_d_network(dest_cbgs):
G = nx.DiGraph()
for i in dest_cbgs:
G.add_edge(*i, weight=dest_cbgs[i])
return G
def generate_network(dest_cbgs):
G = nx.Graph()
for i, j in dest_cbgs.keys():
... | true | true |
1c32746489974f9a1ebb5aee32cae1eeb38fb63b | 2,325 | py | Python | python/expl_impl_euler_optim.py | itpplasma/SIMPLE | 6981791e0a7889647ac5c006325ac951811c2f36 | [
"MIT"
] | 1 | 2020-11-18T14:58:27.000Z | 2020-11-18T14:58:27.000Z | python/expl_impl_euler_optim.py | landreman/SIMPLE | 77722c2479b4a064b99d0e2a58ef7749ce157c07 | [
"MIT"
] | 6 | 2019-10-25T07:52:00.000Z | 2021-11-16T13:19:04.000Z | python/expl_impl_euler_optim.py | landreman/SIMPLE | 77722c2479b4a064b99d0e2a58ef7749ce157c07 | [
"MIT"
] | 2 | 2021-11-05T18:55:09.000Z | 2022-03-23T06:27:04.000Z | """
Created: 2018-08-08
Modified: 2019-03-07
Author: Christopher Albert <albert@alumni.tugraz.at>
"""
from numpy import array, zeros, arange
from scipy.interpolate import lagrange
import common
from common import f, r0, th0, ph0, pph0, timesteps, get_val, get_der2, newton1
from plotting impor... | 29.43038 | 82 | 0.594839 |
from numpy import array, zeros, arange
from scipy.interpolate import lagrange
import common
from common import f, r0, th0, ph0, pph0, timesteps, get_val, get_der2, newton1
from plotting import plot_orbit, plot_cost_function_jac
steps_per_bounce = 8
dt, nt = timesteps(steps_per_bounce, nbounce =... | true | true |
1c3274ff2d683c03bfa991e87a2db167033125f3 | 24,663 | py | Python | sklearn/dummy.py | cperreault11/scikit-learn | 0b78cb00e69109f498c326ad84953954e349d11f | [
"BSD-3-Clause"
] | null | null | null | sklearn/dummy.py | cperreault11/scikit-learn | 0b78cb00e69109f498c326ad84953954e349d11f | [
"BSD-3-Clause"
] | null | null | null | sklearn/dummy.py | cperreault11/scikit-learn | 0b78cb00e69109f498c326ad84953954e349d11f | [
"BSD-3-Clause"
] | null | null | null | # Author: Mathieu Blondel <mathieu@mblondel.org>
# Arnaud Joly <a.joly@ulg.ac.be>
# Maheshakya Wijewardena <maheshakya.10@cse.mrt.ac.lk>
# License: BSD 3 clause
import warnings
import numpy as np
import scipy.sparse as sp
from .base import BaseEstimator, ClassifierMixin, RegressorMixin
from .base impo... | 34.785614 | 88 | 0.575031 |
import warnings
import numpy as np
import scipy.sparse as sp
from .base import BaseEstimator, ClassifierMixin, RegressorMixin
from .base import MultiOutputMixin
from .utils import check_random_state
from .utils import deprecated
from .utils.validation import _num_samples
from .utils.validation import check_array
from... | true | true |
1c32751133d80d21b279bcbbf1b75fcc0b098f72 | 461 | py | Python | poco/drivers/std/screen.py | HBoPRC/Poco | c8b0dc5362db45ff7a8397eebb0c52d9047f4b67 | [
"Apache-2.0"
] | null | null | null | poco/drivers/std/screen.py | HBoPRC/Poco | c8b0dc5362db45ff7a8397eebb0c52d9047f4b67 | [
"Apache-2.0"
] | null | null | null | poco/drivers/std/screen.py | HBoPRC/Poco | c8b0dc5362db45ff7a8397eebb0c52d9047f4b67 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
from poco.sdk.interfaces.screen import ScreenInterface
from poco.utils.simplerpc.utils import sync_wrapper
class StdScreen(ScreenInterface):
def __init__(self, client):
super(StdScreen, self).__init__()
self.client = client
@sync_wrapper
def getScreen(self, width):
... | 24.263158 | 54 | 0.707158 |
from poco.sdk.interfaces.screen import ScreenInterface
from poco.utils.simplerpc.utils import sync_wrapper
class StdScreen(ScreenInterface):
def __init__(self, client):
super(StdScreen, self).__init__()
self.client = client
@sync_wrapper
def getScreen(self, width):
return self.cl... | true | true |
1c327693cb4b39dc20e869248ee2fa581293cdcd | 214 | py | Python | testing/test.py | matthew-cheney/crowd-sorting-single-threaded | f32f05641821f5770dd95787c459888101b93d05 | [
"MIT"
] | 1 | 2019-11-30T07:59:25.000Z | 2019-11-30T07:59:25.000Z | testing/test.py | mchen95/crowd-sorting | f32f05641821f5770dd95787c459888101b93d05 | [
"MIT"
] | 2 | 2019-10-14T17:16:46.000Z | 2019-10-21T23:14:32.000Z | testing/test.py | matthew-cheney/crowd-sorting-single-threaded | f32f05641821f5770dd95787c459888101b93d05 | [
"MIT"
] | null | null | null | import unittest
class Template(unittest.TestCase):
def setUp(self):
pass
def test_basic(self):
self.assertTrue(True)
self.assertFalse(False)
def tearDown(self):
pass
| 15.285714 | 34 | 0.621495 | import unittest
class Template(unittest.TestCase):
def setUp(self):
pass
def test_basic(self):
self.assertTrue(True)
self.assertFalse(False)
def tearDown(self):
pass
| true | true |
1c327792cbf8c219d3adddc8ebbd0b6ee84b5c8a | 32,170 | py | Python | dqc_testsuite_xule.py | altova/sec-edgar-tools | d9d2e66963d1a357f395fc6b022eee30e4a869c5 | [
"Apache-2.0"
] | 9 | 2015-06-10T15:52:45.000Z | 2022-03-23T20:43:38.000Z | dqc_testsuite_xule.py | altova/sec-edgar-tools | d9d2e66963d1a357f395fc6b022eee30e4a869c5 | [
"Apache-2.0"
] | 2 | 2016-12-02T15:16:34.000Z | 2022-03-23T20:46:27.000Z | dqc_testsuite_xule.py | altova/sec-edgar-tools | d9d2e66963d1a357f395fc6b022eee30e4a869c5 | [
"Apache-2.0"
] | 10 | 2016-03-05T21:16:14.000Z | 2022-02-01T08:58:50.000Z | # Copyright 2015-2018 Altova GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | 51.226115 | 223 | 0.666491 | __copyright__ = 'Copyright 2015-2019 Altova GmbH'
__license__ = 'http://www.apache.org/licenses/LICENSE-2.0'
import argparse
import collections
import concurrent.futures
import datetime
import json
import logging
import multiprocessing
import os
import pickle
import re
import tempfile
import time
import urllib.parse
... | true | true |
1c32782758509d96d470bdcdbadf1eea28c768bf | 1,972 | py | Python | axelrod/game.py | danilobellini/Axelrod | 2c9212553e06095c24adcb82a5979279cbdf45fb | [
"MIT"
] | 1 | 2017-11-29T22:37:35.000Z | 2017-11-29T22:37:35.000Z | axelrod/game.py | danilobellini/Axelrod | 2c9212553e06095c24adcb82a5979279cbdf45fb | [
"MIT"
] | 10 | 2020-09-07T19:44:57.000Z | 2020-11-25T06:00:05.000Z | axelrod/game.py | danilobellini/Axelrod | 2c9212553e06095c24adcb82a5979279cbdf45fb | [
"MIT"
] | null | null | null | from typing import Tuple, Union
from axelrod import Action
C, D = Action.C, Action.D
Score = Union[int, float]
class Game(object):
"""Container for the game matrix and scoring logic.
Attributes
----------
scores: dict
The numerical score attribute to all combinations of action pairs.
"... | 29 | 87 | 0.553245 | from typing import Tuple, Union
from axelrod import Action
C, D = Action.C, Action.D
Score = Union[int, float]
class Game(object):
def __init__(self, r: Score = 3, s: Score = 0, t: Score = 5, p: Score = 1) -> None:
self.scores = {(C, C): (r, r), (D, D): (p, p), (C, D): (s, t), (D, C): (t, s)}
def... | true | true |
1c32785b49c7d09a70abf0156d9432ce96763e30 | 4,103 | py | Python | dask/tests/test_threaded.py | lr4d/dask | e405fa0c767a89ec6a413114be831a96cb388443 | [
"BSD-3-Clause"
] | null | null | null | dask/tests/test_threaded.py | lr4d/dask | e405fa0c767a89ec6a413114be831a96cb388443 | [
"BSD-3-Clause"
] | null | null | null | dask/tests/test_threaded.py | lr4d/dask | e405fa0c767a89ec6a413114be831a96cb388443 | [
"BSD-3-Clause"
] | null | null | null | import os
import sys
import signal
import threading
from multiprocessing.pool import ThreadPool
from time import time, sleep
import pytest
import dask
from dask.compatibility import PY2
from dask.threaded import get
from dask.utils_test import inc, add
def test_get():
dsk = {"x": 1, "y": 2, "z": (inc, "x"), "w"... | 23.58046 | 77 | 0.572995 | import os
import sys
import signal
import threading
from multiprocessing.pool import ThreadPool
from time import time, sleep
import pytest
import dask
from dask.compatibility import PY2
from dask.threaded import get
from dask.utils_test import inc, add
def test_get():
dsk = {"x": 1, "y": 2, "z": (inc, "x"), "w"... | true | true |
1c3278aeb432067752f6763a985c005fd4c759c7 | 3,918 | py | Python | src/aws_scatter_gather/s3_sqs_lambda_async_chunked/resources/work_bucket.py | cbuschka/aws-scatter-gather | abebd22aa6449369845a08d4260607745098bb28 | [
"Apache-2.0"
] | 2 | 2020-06-23T08:27:56.000Z | 2020-06-25T08:44:57.000Z | src/aws_scatter_gather/s3_sqs_lambda_async_chunked/resources/work_bucket.py | cbuschka/aws-scatter-gather | abebd22aa6449369845a08d4260607745098bb28 | [
"Apache-2.0"
] | null | null | null | src/aws_scatter_gather/s3_sqs_lambda_async_chunked/resources/work_bucket.py | cbuschka/aws-scatter-gather | abebd22aa6449369845a08d4260607745098bb28 | [
"Apache-2.0"
] | null | null | null | from aws_scatter_gather.util import json
import os
from aws_scatter_gather.util.jsontime import now
from aws_scatter_gather.util.trace import trace
SCOPE = os.environ.get("SCOPE", "")
WORK_BUCKET = "{SCOPE}s3-sqs-lambda-async-chunked-work".format(SCOPE=SCOPE)
async def write_batch_status(batch_id, record_count, ch... | 41.242105 | 98 | 0.662072 | from aws_scatter_gather.util import json
import os
from aws_scatter_gather.util.jsontime import now
from aws_scatter_gather.util.trace import trace
SCOPE = os.environ.get("SCOPE", "")
WORK_BUCKET = "{SCOPE}s3-sqs-lambda-async-chunked-work".format(SCOPE=SCOPE)
async def write_batch_status(batch_id, record_count, ch... | true | true |
1c327aabc7e164668a9f2b0263e36d4c77eebdb0 | 1,597 | py | Python | octohatrack/contributors_file.py | ncoghlan/octohatrack | cb7a0e8011a312a9074a2aa63b640c32fdbaa988 | [
"BSD-3-Clause"
] | null | null | null | octohatrack/contributors_file.py | ncoghlan/octohatrack | cb7a0e8011a312a9074a2aa63b640c32fdbaa988 | [
"BSD-3-Clause"
] | null | null | null | octohatrack/contributors_file.py | ncoghlan/octohatrack | cb7a0e8011a312a9074a2aa63b640c32fdbaa988 | [
"BSD-3-Clause"
] | 1 | 2020-12-18T09:13:50.000Z | 2020-12-18T09:13:50.000Z | #############################################################
#
# WARNING
#
# This module is extremely experimental.
#
# May contain traces of:
# * using the GitHub API to pull content of a repo
# * string parsing
# * gluten
#
###################################################... | 27.534483 | 94 | 0.478397 |
import base64
import re
import hashlib
from .helpers import *
def get_contributors_file(repo_name):
progress("Collecting CONTRIBUTORS file")
response = get_data("/repos/%s/contents/CONTRIBUTORS" % repo_name)
if response is None:
print("No CONTRIBUTORS file")
return []
if "message"... | true | true |
1c327ac5ec64f945e7fd04b7eb965e6ba822b882 | 4,074 | py | Python | scripts/gen_rf_xmacro_def_undo.py | refu-lang/clib | 327aeea6ed480257c1c4638ba21f2c347f5960ae | [
"MIT",
"BSD-3-Clause"
] | 3 | 2017-02-13T22:31:32.000Z | 2021-07-11T11:59:39.000Z | scripts/gen_rf_xmacro_def_undo.py | refu-lang/clib | 327aeea6ed480257c1c4638ba21f2c347f5960ae | [
"MIT",
"BSD-3-Clause"
] | 1 | 2017-02-06T00:13:05.000Z | 2017-02-06T00:13:05.000Z | scripts/gen_rf_xmacro_def_undo.py | refu-lang/rfbase | 327aeea6ed480257c1c4638ba21f2c347f5960ae | [
"MIT",
"BSD-3-Clause"
] | null | null | null | #the maximum number of arguments for a function
maxArgs = 36
#stuff to import to be able to open files in the parent directory
import os.path
import sys
print("Generating rf_xmacro_def_undo.h ...");
f = open(os.path.dirname(sys.argv[0]) + "/../include/Preprocessor/rf_xmacro_def_undo.h","w");
#put some required def... | 34.235294 | 149 | 0.656112 | maxArgs = 36
import os.path
import sys
print("Generating rf_xmacro_def_undo.h ...");
f = open(os.path.dirname(sys.argv[0]) + "/../include/Preprocessor/rf_xmacro_def_undo.h","w");
f.write("/**\n** @author Lefteris\n** @date 13/02/2012\n**\n\
** This file contains #undef so to easily undefine all the macros defined ... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.