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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c3961e9e30bcaa86704d30f24c9675d41c3d1bb | 362 | py | Python | omnik/users/apps.py | pygabo/omnik | 579b20671515d8a38b56df8c5bc837bd201ec7b0 | [
"MIT"
] | null | null | null | omnik/users/apps.py | pygabo/omnik | 579b20671515d8a38b56df8c5bc837bd201ec7b0 | [
"MIT"
] | null | null | null | omnik/users/apps.py | pygabo/omnik | 579b20671515d8a38b56df8c5bc837bd201ec7b0 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class UsersConfig(AppConfig):
name = "omnik.users"
verbose_name = "Users"
def ready(self):
"""Override this to put in:
Users system checks
Users signal registration
"""
try:
import users.signals # noqa F401
... | 21.294118 | 45 | 0.569061 | from django.apps import AppConfig
class UsersConfig(AppConfig):
name = "omnik.users"
verbose_name = "Users"
def ready(self):
try:
import users.signals except ImportError:
pass
| true | true |
1c3961f1f78f462d00857e47927e65b6a6d8eba1 | 141,178 | py | Python | lib/sqlalchemy/sql/expression.py | obeattie/sqlalchemy | 376007fed7746d494dcb0166b22e512bfece02cd | [
"MIT"
] | 2 | 2016-05-09T09:17:35.000Z | 2016-08-03T16:30:16.000Z | lib/sqlalchemy/sql/expression.py | clones/sqlalchemy | c9f08aa78a48ba53dd221d3c5de54e5956ecf806 | [
"MIT"
] | null | null | null | lib/sqlalchemy/sql/expression.py | clones/sqlalchemy | c9f08aa78a48ba53dd221d3c5de54e5956ecf806 | [
"MIT"
] | null | null | null | # expression.py
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Michael Bayer mike_mp@zzzcomputing.com
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Defines the base components of SQL expression trees.
All components are derived... | 33.734289 | 115 | 0.622817 |
import itertools, re
from operator import attrgetter
from sqlalchemy import util, exc from sqlalchemy.sql import operators
from sqlalchemy.sql.visitors import Visitable, cloned_traverse
import operator
functions, schema, sql_util, sqltypes = None, None, None, None
DefaultDialect, ClauseAdapter, Annotated = None, No... | true | true |
1c3962023870626bf65e5b10720a0f2283523934 | 617 | py | Python | benchmarks/storage/insertions.py | OneManEquipe/thinkerino | 4b9508156371643f31d1d26608e42e3aafcb0153 | [
"MIT"
] | 1 | 2020-05-02T19:44:18.000Z | 2020-05-02T19:44:18.000Z | benchmarks/storage/insertions.py | OneManEquipe/aitools | 4b9508156371643f31d1d26608e42e3aafcb0153 | [
"MIT"
] | 29 | 2019-08-07T17:49:03.000Z | 2021-08-31T10:25:00.000Z | benchmarks/storage/insertions.py | OneManEquipe/thinkerino | 4b9508156371643f31d1d26608e42e3aafcb0153 | [
"MIT"
] | null | null | null | from typing import Callable, Iterable
from aitools.logic import LogicObject
from aitools.storage.base import LogicObjectStorage
def leave_storage_empty(
storage: LogicObjectStorage,
initial_distribution: Callable[[], Iterable[LogicObject]]
) -> LogicObjectStorage:
return storage
def make_insert_n... | 32.473684 | 106 | 0.750405 | from typing import Callable, Iterable
from aitools.logic import LogicObject
from aitools.storage.base import LogicObjectStorage
def leave_storage_empty(
storage: LogicObjectStorage,
initial_distribution: Callable[[], Iterable[LogicObject]]
) -> LogicObjectStorage:
return storage
def make_insert_n... | true | true |
1c39636ebf838cf141a618ce92264d7097ceb929 | 1,620 | py | Python | src-py/gen.py | vtad4f/partitioner | 13494a0fd486f2475c788300206171f6d8a7a897 | [
"MIT"
] | null | null | null | src-py/gen.py | vtad4f/partitioner | 13494a0fd486f2475c788300206171f6d8a7a897 | [
"MIT"
] | null | null | null | src-py/gen.py | vtad4f/partitioner | 13494a0fd486f2475c788300206171f6d8a7a897 | [
"MIT"
] | null | null | null |
import random
def Main(fpath, n_vertices, n_edges, v_range=10, e_range=10):
"""
BRIEF Main execution (all but cmd line parsing)
"""
# Create file with single graph
with open(fpath, 'w') as f:
f.write('# t 1\n')
# Add vertices
vertices = range(n_vertices)
for v i... | 28.928571 | 108 | 0.524691 |
import random
def Main(fpath, n_vertices, n_edges, v_range=10, e_range=10):
with open(fpath, 'w') as f:
f.write('# t 1\n')
vertices = range(n_vertices)
for v in vertices:
f.write('v {0} {1}\n'.format(v, random.choice(range(v_range))))
edges = s... | true | true |
1c39645a0bc17b9cb1034ee80c11537442818baf | 5,014 | py | Python | bq_du/du.py | solution3o6s/bq-tools | 00e5f6714724bc4034fed8afd26c8eec34d4a560 | [
"Apache-2.0"
] | null | null | null | bq_du/du.py | solution3o6s/bq-tools | 00e5f6714724bc4034fed8afd26c8eec34d4a560 | [
"Apache-2.0"
] | null | null | null | bq_du/du.py | solution3o6s/bq-tools | 00e5f6714724bc4034fed8afd26c8eec34d4a560 | [
"Apache-2.0"
] | null | null | null | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use du file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Lic... | 25.451777 | 115 | 0.623454 |
import json
import argparse
from google.cloud import bigquery
class DuClient(object):
def __init__(self, legacy, bq_table_name):
self.client = bigquery.Client()
self.table_name = '[{}]'.format(bq_table_name) if legacy else '`{}`'.format(bq_table_name)
self.job_config = bigquery.QueryJobC... | true | true |
1c39648bd9b3c766508517dd33c70d81bcea3cf4 | 677 | py | Python | backend/cloud-run-api/app/main.py | tuxedocat/fast-annotation-tool | 2e28e81bf5b383ac033eeae847921d68ed302556 | [
"Apache-2.0"
] | 24 | 2021-06-08T06:20:55.000Z | 2022-03-24T07:27:08.000Z | backend/cloud-run-api/app/main.py | shunyooo/fast-annotation-tool | 0f7b23eb9e664daf33c6ada366ea550996d103b3 | [
"Apache-2.0"
] | null | null | null | backend/cloud-run-api/app/main.py | shunyooo/fast-annotation-tool | 0f7b23eb9e664daf33c6ada366ea550996d103b3 | [
"Apache-2.0"
] | 6 | 2021-06-08T02:39:31.000Z | 2022-01-08T15:10:01.000Z | from fastapi import FastAPI
from fastapi.exceptions import RequestValidationError
from starlette.exceptions import HTTPException
from app.api.errors.http_error import http_error_handler
from app.api.errors.validation_error import http422_error_handler
from app.api.routes.api import router as api_router
from app.config... | 29.434783 | 76 | 0.82127 | from fastapi import FastAPI
from fastapi.exceptions import RequestValidationError
from starlette.exceptions import HTTPException
from app.api.errors.http_error import http_error_handler
from app.api.errors.validation_error import http422_error_handler
from app.api.routes.api import router as api_router
from app.config... | true | true |
1c3964ad3ab8088a59258ab382cba7f9e14aea70 | 10,926 | bzl | Python | tools/build_rules/llvm/llvm.bzl | cushon/kythe | 1e1d70062adac6e28a3ecdd2b078784d970ff036 | [
"Apache-2.0"
] | null | null | null | tools/build_rules/llvm/llvm.bzl | cushon/kythe | 1e1d70062adac6e28a3ecdd2b078784d970ff036 | [
"Apache-2.0"
] | null | null | null | tools/build_rules/llvm/llvm.bzl | cushon/kythe | 1e1d70062adac6e28a3ecdd2b078784d970ff036 | [
"Apache-2.0"
] | null | null | null | load("@io_kythe//tools/build_rules/llvm:configure_file.bzl", "configure_file")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_skylib//lib:collections.bzl", "collections")
def _repo_path(path):
if native.repository_name() == "@":
return path
return paths.join("external", native.repository_na... | 33.722222 | 116 | 0.59244 | load("@io_kythe//tools/build_rules/llvm:configure_file.bzl", "configure_file")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_skylib//lib:collections.bzl", "collections")
def _repo_path(path):
if native.repository_name() == "@":
return path
return paths.join("external", native.repository_na... | true | true |
1c39654fddeef90c7cae5292359b0417674b4bab | 1,331 | py | Python | lib/utils/blob.py | czy779509408/text-detection-ctpn | e0cf757a33e83ead6dd6330ba47f5053de12c506 | [
"MIT"
] | 2,744 | 2018-04-13T09:51:22.000Z | 2022-03-29T03:07:19.000Z | lib/utils/blob.py | infinitisun/text-detection-ctpn | b94c3af3d5105b5a9ff4d4a00edf92b2d55ee4cf | [
"MIT"
] | 370 | 2018-04-17T05:36:53.000Z | 2022-02-22T02:54:10.000Z | lib/utils/blob.py | infinitisun/text-detection-ctpn | b94c3af3d5105b5a9ff4d4a00edf92b2d55ee4cf | [
"MIT"
] | 1,145 | 2018-04-13T09:52:49.000Z | 2022-03-29T02:21:13.000Z | """Blob helper functions."""
import numpy as np
import cv2
from ..fast_rcnn.config import cfg
def im_list_to_blob(ims):
"""Convert a list of images into a network input.
Assumes images are already prepared (means subtracted, BGR order, ...).
"""
max_shape = np.array([im.shape for im in ims]).max(axis=... | 34.128205 | 75 | 0.641623 | import numpy as np
import cv2
from ..fast_rcnn.config import cfg
def im_list_to_blob(ims):
max_shape = np.array([im.shape for im in ims]).max(axis=0)
num_images = len(ims)
blob = np.zeros((num_images, max_shape[0], max_shape[1], 3),
dtype=np.float32)
for i in range(num_images):
... | true | true |
1c3966ae8c19d2b47f51f085ab2346131c2fd72e | 1,679 | py | Python | classification/video/models/multi_column.py | liaojh1998/cross-modal-concept2robot | 2a00937eb2ac02cbe3d5d5fa0f5868e85d194f6e | [
"MIT"
] | 4 | 2021-08-04T08:14:36.000Z | 2022-03-14T05:59:46.000Z | classification/video/models/multi_column.py | liaojh1998/cross-modal-concept2robot | 2a00937eb2ac02cbe3d5d5fa0f5868e85d194f6e | [
"MIT"
] | null | null | null | classification/video/models/multi_column.py | liaojh1998/cross-modal-concept2robot | 2a00937eb2ac02cbe3d5d5fa0f5868e85d194f6e | [
"MIT"
] | 2 | 2021-08-28T13:19:31.000Z | 2021-09-17T17:48:41.000Z | import torch.nn as nn
import torch as th
class MultiColumn(nn.Module):
def __init__(self, num_classes, conv_column, column_units, clf_layers=None):
"""
- Example multi-column network
- Useful when a video sample is too long and has to be split into
multiple clips
- Processes 3D-CNN on each cli... | 31.679245 | 91 | 0.670042 | import torch.nn as nn
import torch as th
class MultiColumn(nn.Module):
def __init__(self, num_classes, conv_column, column_units, clf_layers=None):
super(MultiColumn,self).__init__()
self.num_classes = num_classes
self.column_units = column_units
self.conv_column = conv_column(column_units)
self.... | true | true |
1c3966d1c3bf00b34857f8cdb57221aed0476bac | 2,833 | py | Python | stellar_sdk/xdr/data_entry.py | MartinThoma/py-stellar-base | 07ab28cde7a7040f2262b224f9af8a3416c0e5ab | [
"Apache-2.0"
] | 341 | 2015-10-06T20:56:19.000Z | 2022-03-23T15:58:54.000Z | stellar_sdk/xdr/data_entry.py | MartinThoma/py-stellar-base | 07ab28cde7a7040f2262b224f9af8a3416c0e5ab | [
"Apache-2.0"
] | 479 | 2015-11-09T18:39:40.000Z | 2022-03-16T06:46:58.000Z | stellar_sdk/xdr/data_entry.py | MartinThoma/py-stellar-base | 07ab28cde7a7040f2262b224f9af8a3416c0e5ab | [
"Apache-2.0"
] | 181 | 2015-10-01T23:00:59.000Z | 2022-03-05T13:42:19.000Z | # This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
import base64
from xdrlib import Packer, Unpacker
from .account_id import AccountID
from .data_entry_ext import DataEntryExt
from .data_value import DataValue
from .string64 import String64
__all__ = ["DataEntry"]
class Data... | 27.504854 | 68 | 0.56689 | import base64
from xdrlib import Packer, Unpacker
from .account_id import AccountID
from .data_entry_ext import DataEntryExt
from .data_value import DataValue
from .string64 import String64
__all__ = ["DataEntry"]
class DataEntry:
def __init__(
self,
account_id: AccountID,
data_name: St... | true | true |
1c3966eb786a38df5ac338b4127d1c9e4ab97ea4 | 2,016 | py | Python | modmail/__init__.py | Salvi0/modmail-2 | d47e09784d6c9c063ec4083a1a4f40ecb275bdab | [
"MIT"
] | 23 | 2021-05-17T06:07:55.000Z | 2021-05-23T00:57:39.000Z | modmail/__init__.py | Salvi0/modmail-2 | d47e09784d6c9c063ec4083a1a4f40ecb275bdab | [
"MIT"
] | 19 | 2021-11-01T07:21:11.000Z | 2022-01-14T04:59:34.000Z | modmail/__init__.py | Salvi0/modmail-2 | d47e09784d6c9c063ec4083a1a4f40ecb275bdab | [
"MIT"
] | null | null | null | import asyncio
import logging
import logging.handlers
import os
from pathlib import Path
import coloredlogs
from modmail.log import ModmailLogger
# On windows aiodns's asyncio support relies on APIs like add_reader (which aiodns uses)
# are not guaranteed to be available, and in particular are not available when us... | 29.217391 | 92 | 0.764881 | import asyncio
import logging
import logging.handlers
import os
from pathlib import Path
import coloredlogs
from modmail.log import ModmailLogger
# are not guaranteed to be available, and in particular are not available when using the
# ProactorEventLoop on Windows, this method is only supported with Windows Select... | true | true |
1c3966f40eff3e4c45413f5ea232dbbe2997a3ca | 879 | py | Python | petidlookup/__main__.py | puremourning/petidlookup | d436895146cdc76325d48e417b286acd50f787d7 | [
"Apache-2.0"
] | 1 | 2020-08-08T07:56:32.000Z | 2020-08-08T07:56:32.000Z | petidlookup/__main__.py | puremourning/petidlookup | d436895146cdc76325d48e417b286acd50f787d7 | [
"Apache-2.0"
] | null | null | null | petidlookup/__main__.py | puremourning/petidlookup | d436895146cdc76325d48e417b286acd50f787d7 | [
"Apache-2.0"
] | null | null | null | # Copyright 2016 Ben Jackson
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 35.16 | 77 | 0.734926 |
from . import lookup
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument( '--file', '-f', type=str, help='Input file name' )
parser.add_argument( '--outfile', '-o', type=str, help='Output file name' )
args = parser.parse_args()
lookup.run( args )
| true | true |
1c3967230e860dd0c7209ef55cc6ca22ad497729 | 160 | py | Python | food/urls.py | evangelos1990/firsttry | c782a58cca636a81da0102e4e4294fd5c9e86d8a | [
"Unlicense"
] | null | null | null | food/urls.py | evangelos1990/firsttry | c782a58cca636a81da0102e4e4294fd5c9e86d8a | [
"Unlicense"
] | 2 | 2020-06-14T12:36:35.000Z | 2021-06-10T23:03:13.000Z | food/urls.py | evangelos1990/firsttry | c782a58cca636a81da0102e4e4294fd5c9e86d8a | [
"Unlicense"
] | null | null | null | # food/urls.py
from django.conf.urls import url
from django.urls import path
from food import views
urlpatterns = [
path('', views.index, name='index'),
] | 17.777778 | 40 | 0.7125 | from django.conf.urls import url
from django.urls import path
from food import views
urlpatterns = [
path('', views.index, name='index'),
] | true | true |
1c396842a02555f4ec3e88322fd8a6786b41cd9f | 3,508 | py | Python | test/scripts/test_restart.py | fujiehuang/ecto | fea744337aa1fad1397c9a3ba5baa143993cb5eb | [
"BSD-3-Clause"
] | null | null | null | test/scripts/test_restart.py | fujiehuang/ecto | fea744337aa1fad1397c9a3ba5baa143993cb5eb | [
"BSD-3-Clause"
] | null | null | null | test/scripts/test_restart.py | fujiehuang/ecto | fea744337aa1fad1397c9a3ba5baa143993cb5eb | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
#
# Copyright (c) 2011, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# not... | 34.732673 | 106 | 0.670182 |
import sys, ecto, ecto_test
def makeplasm(N):
plasm = ecto.Plasm()
gen = ecto_test.Generate(start=1, step=1)
quitter = ecto_test.QuitAfter(N=N)
plasm.connect(gen[:] >> quitter[:])
return (quitter, gen, plasm)
def do_one_impl(SchedType, countto, nthreads, niter):
print("*"*80, "\n", SchedTy... | true | true |
1c396bf46db83c817eec77146fc8d8af2b14f3f1 | 63 | py | Python | learn_python/learn_pytest_and_allure/tests/utils/help_functions.py | yehonadav/yonadav_tutorials | e797fdaeaea4c5d85392f724442645afb9391f15 | [
"Apache-2.0"
] | 2 | 2019-08-04T17:30:53.000Z | 2020-09-21T08:39:55.000Z | learn_python/learn_pytest_and_allure/tests/utils/help_functions.py | yehonadav/yonadav_tutorials | e797fdaeaea4c5d85392f724442645afb9391f15 | [
"Apache-2.0"
] | 5 | 2019-10-31T14:55:58.000Z | 2022-02-26T04:06:39.000Z | learn_python/learn_pytest_and_allure/tests/utils/help_functions.py | yehonadav/yonadav_tutorials | e797fdaeaea4c5d85392f724442645afb9391f15 | [
"Apache-2.0"
] | null | null | null | def f():
raise SystemExit(1)
def inc(x):
return x + 1 | 10.5 | 23 | 0.555556 | def f():
raise SystemExit(1)
def inc(x):
return x + 1 | true | true |
1c396d96ba17524bb112d648221bced5c3b70181 | 1,061 | py | Python | repos/system_upgrade/el7toel8/actors/rpmscanner/actor.py | Jakuje/leapp-repository | 580540f68bd4f89152c28935f775f660c2db0839 | [
"Apache-2.0"
] | null | null | null | repos/system_upgrade/el7toel8/actors/rpmscanner/actor.py | Jakuje/leapp-repository | 580540f68bd4f89152c28935f775f660c2db0839 | [
"Apache-2.0"
] | 1 | 2020-06-15T18:32:21.000Z | 2020-06-15T18:32:21.000Z | repos/system_upgrade/el7toel8/actors/rpmscanner/actor.py | kubco2/leapp-repository | ad98ad91d06d0adfe945566a414c95df862c4172 | [
"Apache-2.0"
] | null | null | null | from leapp.actors import Actor
from leapp.libraries.common.rpms import get_installed_rpms
from leapp.models import InstalledRPM, RPM
from leapp.tags import IPUWorkflowTag, FactsPhaseTag
class RpmScanner(Actor):
"""
Provides data about installed RPM Packages.
After collecting data from RPM query, a messag... | 28.675676 | 88 | 0.598492 | from leapp.actors import Actor
from leapp.libraries.common.rpms import get_installed_rpms
from leapp.models import InstalledRPM, RPM
from leapp.tags import IPUWorkflowTag, FactsPhaseTag
class RpmScanner(Actor):
name = 'rpm_scanner'
consumes = ()
produces = (InstalledRPM,)
tags = (IPUWorkflowTag, Fact... | true | true |
1c396dc98cc3b66a53dfb013d2b11bad8dc6be3c | 14,742 | py | Python | simulate/parse/_system_topology.py | charles9li/simulate-openmm | cfc76294dd4b00147769fc83c7673fce5bd499cc | [
"MIT"
] | null | null | null | simulate/parse/_system_topology.py | charles9li/simulate-openmm | cfc76294dd4b00147769fc83c7673fce5bd499cc | [
"MIT"
] | null | null | null | simulate/parse/_system_topology.py | charles9li/simulate-openmm | cfc76294dd4b00147769fc83c7673fce5bd499cc | [
"MIT"
] | null | null | null | """
_system_topology.py: Parses topology information for a system.
Copyright (c) 2020 Charles Li // UCSB, Department of Chemical Engineering
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 withou... | 43.358824 | 131 | 0.592593 | from __future__ import absolute_import
__author__ = "Charles Li"
__version__ = "1.0"
import os
from ast import literal_eval
import numpy as np
from simtk.openmm.app import Element, ForceField, NoCutoff, Topology
from simtk.unit import nanometer
from ._options import _Options
from ._system_topology_chain import Chain... | true | true |
1c396ef7bd19ebc1898c3ce8edba54d4d9b77dfc | 424 | py | Python | tests/src/year2017/test_day09b.py | lancelote/advent_of_code | 06dda6ca034bc1e86addee7798bb9b2a34ff565b | [
"Unlicense"
] | 10 | 2017-12-11T17:54:52.000Z | 2021-12-09T20:16:30.000Z | tests/src/year2017/test_day09b.py | lancelote/advent_of_code | 06dda6ca034bc1e86addee7798bb9b2a34ff565b | [
"Unlicense"
] | 260 | 2015-12-09T11:03:03.000Z | 2021-12-12T14:32:23.000Z | tests/src/year2017/test_day09b.py | lancelote/advent_of_code | 06dda6ca034bc1e86addee7798bb9b2a34ff565b | [
"Unlicense"
] | null | null | null | """2017 - Day 9 Part 2: Stream Processing tests."""
import pytest
from src.year2017.day09b import solve
@pytest.mark.parametrize(
("stream", "expected"),
[
("<>", 0),
("<random characters>", 17),
("<<<<>", 3),
("<{!>}>", 2),
("<!!>", 0),
("<!!!>>", 0),
... | 20.190476 | 51 | 0.459906 | import pytest
from src.year2017.day09b import solve
@pytest.mark.parametrize(
("stream", "expected"),
[
("<>", 0),
("<random characters>", 17),
("<<<<>", 3),
("<{!>}>", 2),
("<!!>", 0),
("<!!!>>", 0),
('<{o"i!a,<{i<a>', 10),
],
)
def test_solve(stre... | true | true |
1c396efc3cf4df445e482ec254bd83587ce2d238 | 519 | py | Python | backend/backend/asgi.py | Dokeey/flexchat | 1e62f8ea054bd526cd5bf1c0db12f986b12ed559 | [
"MIT"
] | 1 | 2020-09-30T10:15:05.000Z | 2020-09-30T10:15:05.000Z | backend/backend/asgi.py | Dokeey/flexchat | 1e62f8ea054bd526cd5bf1c0db12f986b12ed559 | [
"MIT"
] | 7 | 2020-08-31T09:56:26.000Z | 2021-03-01T14:53:00.000Z | backend/backend/asgi.py | Dokeey/flexchat | 1e62f8ea054bd526cd5bf1c0db12f986b12ed559 | [
"MIT"
] | null | null | null | """
ASGI config for backend project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
import django
from channels.routing import get_default_application
from django.core.as... | 25.95 | 78 | 0.801541 |
import os
import django
from channels.routing import get_default_application
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings.prod')
django.setup()
application = get_default_application() | true | true |
1c396f24dcb59ef5b6b1524ecddeb41ddb5c93bd | 172 | py | Python | api/urls.py | MECKEM-COV-19/backend | c0686f32f98b3acd5dc028d8a054089694654a07 | [
"MIT"
] | null | null | null | api/urls.py | MECKEM-COV-19/backend | c0686f32f98b3acd5dc028d8a054089694654a07 | [
"MIT"
] | 4 | 2020-03-22T12:27:45.000Z | 2021-06-10T22:44:00.000Z | api/urls.py | MECKEM-COV-19/backend | c0686f32f98b3acd5dc028d8a054089694654a07 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
from graphene_django.views import GraphQLView
urlpatterns = [
path('graphql/', GraphQLView.as_view(graphiql=True)),
] | 21.5 | 57 | 0.767442 | from django.urls import path
from . import views
from graphene_django.views import GraphQLView
urlpatterns = [
path('graphql/', GraphQLView.as_view(graphiql=True)),
] | true | true |
1c396fe42c1941a4fdbd1abdeeb2b7d8bceff0c2 | 14,588 | py | Python | keras_applications/inception_v3_nadee.py | nadee13/keras_applications | 65ca5b17c71b3b3f0191576c03353cc26af9c289 | [
"MIT"
] | null | null | null | keras_applications/inception_v3_nadee.py | nadee13/keras_applications | 65ca5b17c71b3b3f0191576c03353cc26af9c289 | [
"MIT"
] | null | null | null | keras_applications/inception_v3_nadee.py | nadee13/keras_applications | 65ca5b17c71b3b3f0191576c03353cc26af9c289 | [
"MIT"
] | null | null | null | """Inception V3 model for Keras.
Note that the input image format for this model is different than for
the VGG16 and ResNet models (299x299 instead of 224x224),
and that the input preprocessing function is also different (same as Xception).
# Reference
- [Rethinking the Inception Architecture for Computer Vision](
... | 35.754902 | 80 | 0.603304 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from . import get_submodules_from_kwargs
from . import imagenet_utils
from .imagenet_utils import decode_predictions
from .imagenet_utils import _obtain_input_shape
WEIGHTS_PATH = (
'https://gi... | true | true |
1c3972136fc6ff85b47ef462a1a1317f6bf42fed | 717 | py | Python | setup.py | CIIRC-ISI/PyAutomationML | 19272934dfbb15a2665b8c55058f94b0e55d2879 | [
"BSD-3-Clause"
] | null | null | null | setup.py | CIIRC-ISI/PyAutomationML | 19272934dfbb15a2665b8c55058f94b0e55d2879 | [
"BSD-3-Clause"
] | null | null | null | setup.py | CIIRC-ISI/PyAutomationML | 19272934dfbb15a2665b8c55058f94b0e55d2879 | [
"BSD-3-Clause"
] | null | null | null | import pathlib
from setuptools import setup
HERE = pathlib.Path(__file__).parent
README = (HERE / "README.md").read_text()
setup(
name='pyautomationml',
description='Library for processing AutomationML files in python',
long_description=README,
long_description_content_type="text/markdown",
url="h... | 27.576923 | 70 | 0.658298 | import pathlib
from setuptools import setup
HERE = pathlib.Path(__file__).parent
README = (HERE / "README.md").read_text()
setup(
name='pyautomationml',
description='Library for processing AutomationML files in python',
long_description=README,
long_description_content_type="text/markdown",
url="h... | true | true |
1c3972452c8a9c15f17df7204dfd01c76b40005d | 1,344 | py | Python | to_images.py | qhjqhj00/ConV2020 | 680c4b8eb9e9568471e414f6e763e838bca0025e | [
"Apache-2.0"
] | null | null | null | to_images.py | qhjqhj00/ConV2020 | 680c4b8eb9e9568471e414f6e763e838bca0025e | [
"Apache-2.0"
] | null | null | null | to_images.py | qhjqhj00/ConV2020 | 680c4b8eb9e9568471e414f6e763e838bca0025e | [
"Apache-2.0"
] | null | null | null | import matplotlib
matplotlib.use('Agg')
import pandas as pd
from matplotlib import pyplot as plt
import os
from pypinyin import lazy_pinyin
from matplotlib.ticker import MaxNLocator
import re
target_dir = './res/'
picture = './images/'
func = lambda z:dict([(x, y) for y, x in z.items()])
def plot(x,y,t,a):
ax ... | 24.436364 | 73 | 0.570685 | import matplotlib
matplotlib.use('Agg')
import pandas as pd
from matplotlib import pyplot as plt
import os
from pypinyin import lazy_pinyin
from matplotlib.ticker import MaxNLocator
import re
target_dir = './res/'
picture = './images/'
func = lambda z:dict([(x, y) for y, x in z.items()])
def plot(x,y,t,a):
ax ... | true | true |
1c39726e349a0005641f4c91d20c9491a42311a3 | 62,089 | py | Python | nipype/interfaces/freesurfer/model.py | moloney/nipype | a7a9c85c79cb1412ba03406074f83200447ef50b | [
"Apache-2.0"
] | null | null | null | nipype/interfaces/freesurfer/model.py | moloney/nipype | a7a9c85c79cb1412ba03406074f83200447ef50b | [
"Apache-2.0"
] | null | null | null | nipype/interfaces/freesurfer/model.py | moloney/nipype | a7a9c85c79cb1412ba03406074f83200447ef50b | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The freesurfer module provides basic functions for interfacing with
freesurfer tools.
"""
from __future__ import (print_function, division, unicode_literals,
... | 37.698239 | 239 | 0.598914 | from __future__ import (print_function, division, unicode_literals,
absolute_import)
import os
from ...utils.filemanip import fname_presuffix, split_filename
from ..base import (TraitedSpec, File, traits, InputMultiPath, OutputMultiPath,
Directory, isdefined)
from .base imp... | true | true |
1c3973532340e2fde1f06a6cd7564ce5420b57a7 | 1,701 | py | Python | lenstronomy/GalKin/aperture.py | jiwoncpark/lenstronomy | c1d12580f8d8cf1d065d80568a58c0694e23945a | [
"MIT"
] | 1 | 2020-07-31T07:55:17.000Z | 2020-07-31T07:55:17.000Z | lenstronomy/GalKin/aperture.py | jiwoncpark/lenstronomy | c1d12580f8d8cf1d065d80568a58c0694e23945a | [
"MIT"
] | null | null | null | lenstronomy/GalKin/aperture.py | jiwoncpark/lenstronomy | c1d12580f8d8cf1d065d80568a58c0694e23945a | [
"MIT"
] | 2 | 2020-10-26T10:45:11.000Z | 2021-03-04T12:25:19.000Z | __author__ = 'sibirrer'
from lenstronomy.GalKin.aperture_types import Shell, Slit, IFUShells, Frame
"""
class that defines the aperture of the measurement (e.g. slit, integral field spectroscopy regions etc)
Available aperture types:
-------------------------
'slit': length, width, center_ra, center_dec, angle
'sh... | 32.711538 | 127 | 0.650794 | __author__ = 'sibirrer'
from lenstronomy.GalKin.aperture_types import Shell, Slit, IFUShells, Frame
class Aperture(object):
def __init__(self, aperture_type, **kwargs_aperture):
if aperture_type == 'slit':
self._aperture = Slit(**kwargs_aperture)
elif aperture_type == 'shell':
... | true | true |
1c3974a1211e3f805b943edfec236b31e43b98b3 | 176,984 | py | Python | mne_qt_browser/_pg_figure.py | cbrnr/mne-qt-browser | 8ed661d2317d0bfc4c25fdbcabcdf2ea581d2f1c | [
"BSD-3-Clause"
] | null | null | null | mne_qt_browser/_pg_figure.py | cbrnr/mne-qt-browser | 8ed661d2317d0bfc4c25fdbcabcdf2ea581d2f1c | [
"BSD-3-Clause"
] | null | null | null | mne_qt_browser/_pg_figure.py | cbrnr/mne-qt-browser | 8ed661d2317d0bfc4c25fdbcabcdf2ea581d2f1c | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""Base classes and functions for 2D browser backends."""
# Author: Martin Schulz <dev@earthman-music.de>
#
# License: BSD-3-Clause
import datetime
import functools
import gc
import math
import platform
import sys
from ast import literal_eval
from collections import OrderedDict
from contextlib... | 39.043459 | 79 | 0.563492 |
import datetime
import functools
import gc
import math
import platform
import sys
from ast import literal_eval
from collections import OrderedDict
from contextlib import contextmanager
from copy import copy
from functools import partial
from os.path import getsize
import numpy as np
from PyQt5.QtCore import (QEvent,... | true | true |
1c39772396aa4a5b2ffc82f65daf4a0da685acbb | 1,081 | py | Python | Datasets/NumpyGenerator/NumpyRandomNormalDriftGenerator.py | Lucciola111/stream_autoencoder_windowing | 5456b07bd20220c987598db2cdb832d8195e1575 | [
"MIT"
] | 4 | 2021-09-16T05:50:25.000Z | 2021-12-31T07:04:55.000Z | Datasets/NumpyGenerator/NumpyRandomNormalDriftGenerator.py | Lucciola111/stream_autoencoder_windowing | 5456b07bd20220c987598db2cdb832d8195e1575 | [
"MIT"
] | null | null | null | Datasets/NumpyGenerator/NumpyRandomNormalDriftGenerator.py | Lucciola111/stream_autoencoder_windowing | 5456b07bd20220c987598db2cdb832d8195e1575 | [
"MIT"
] | 1 | 2021-12-16T06:53:08.000Z | 2021-12-16T06:53:08.000Z | from Datasets.NumpyGenerator.NumpyRandomNormalStreamGenerator import numpy_random_normal_stream_generator
def numpy_random_normal_drift_generator(
data_stream, mean_broken, var_broken, n_dimensions_broken, start_dimensions_broken):
"""
Parameters
----------
data_stream: data stream where drif... | 37.275862 | 111 | 0.779833 | from Datasets.NumpyGenerator.NumpyRandomNormalStreamGenerator import numpy_random_normal_stream_generator
def numpy_random_normal_drift_generator(
data_stream, mean_broken, var_broken, n_dimensions_broken, start_dimensions_broken):
n_instances = len(data_stream)
dimensions_broken = numpy_random_n... | true | true |
1c3979aeaf8ca52f2b4e129cade43c4fe8b17290 | 1,730 | py | Python | table_enforcer/utils/validate/decorators.py | xguse/table_enforcer | f3137839574bf8ea933a14ea16a8acba45e3e0c3 | [
"MIT"
] | 13 | 2017-11-16T23:24:17.000Z | 2021-05-28T01:05:31.000Z | table_enforcer/utils/validate/decorators.py | xguse/table_enforcer | f3137839574bf8ea933a14ea16a8acba45e3e0c3 | [
"MIT"
] | 1 | 2019-09-26T18:34:21.000Z | 2021-10-12T17:18:24.000Z | table_enforcer/utils/validate/decorators.py | xguse/table_enforcer | f3137839574bf8ea933a14ea16a8acba45e3e0c3 | [
"MIT"
] | 1 | 2017-11-17T17:18:31.000Z | 2017-11-17T17:18:31.000Z | """Provide decoration functions to augment the behavior of validator functions."""
import functools
def minmax(low, high):
"""Test that the data items fall within range: low <= x <= high."""
def decorator(function):
"""Decorate a function with args."""
@functools.wraps(function)
def wr... | 28.360656 | 82 | 0.569942 | import functools
def minmax(low, high):
def decorator(function):
@functools.wraps(function)
def wrapper(*args, **kwargs):
series = function(*args, **kwargs)
lo_pass = low <= series
hi_pass = series <= high
return lo_pass & hi_pass
return wr... | true | true |
1c397c1c2056b008156c3000c97255a269a556fd | 3,543 | py | Python | index.py | AaryanSinhaRoy/link-saver | 1970c3d1733d76891b59e3527662d0502456e379 | [
"MIT"
] | null | null | null | index.py | AaryanSinhaRoy/link-saver | 1970c3d1733d76891b59e3527662d0502456e379 | [
"MIT"
] | null | null | null | index.py | AaryanSinhaRoy/link-saver | 1970c3d1733d76891b59e3527662d0502456e379 | [
"MIT"
] | null | null | null | from flask import Flask, render_template,url_for, request, session, redirect
import sqlite3
import requests
from bs4 import BeautifulSoup
app = Flask(__name__)
app.secret_key='voat'
create_table="create table if not exists users ( username varchar(255), password varchar(255))"
conn=sqlite3.connect("database.... | 31.633929 | 130 | 0.62433 | from flask import Flask, render_template,url_for, request, session, redirect
import sqlite3
import requests
from bs4 import BeautifulSoup
app = Flask(__name__)
app.secret_key='voat'
create_table="create table if not exists users ( username varchar(255), password varchar(255))"
conn=sqlite3.connect("database.... | true | true |
1c397ccaa82943aaaf39168260a36d7c20628590 | 487 | py | Python | interview/leet/189_Rotate_Array.py | eroicaleo/LearningPython | 297d46eddce6e43ce0c160d2660dff5f5d616800 | [
"MIT"
] | 1 | 2020-10-12T13:33:29.000Z | 2020-10-12T13:33:29.000Z | interview/leet/189_Rotate_Array.py | eroicaleo/LearningPython | 297d46eddce6e43ce0c160d2660dff5f5d616800 | [
"MIT"
] | null | null | null | interview/leet/189_Rotate_Array.py | eroicaleo/LearningPython | 297d46eddce6e43ce0c160d2660dff5f5d616800 | [
"MIT"
] | 1 | 2016-11-09T07:28:45.000Z | 2016-11-09T07:28:45.000Z | #!/usr/bin/env python3
import math
class Solution:
def rotate(self, nums, k):
l = len(nums)
d = math.gcd(k, l)
for i in range(d):
p, q, prev = i, (i+k)%l, nums[i]
while q != i:
tmp = nums[q]
nums[q] = prev
p, q, prev ... | 20.291667 | 44 | 0.439425 |
import math
class Solution:
def rotate(self, nums, k):
l = len(nums)
d = math.gcd(k, l)
for i in range(d):
p, q, prev = i, (i+k)%l, nums[i]
while q != i:
tmp = nums[q]
nums[q] = prev
p, q, prev = q, (q+k)%l, tmp
... | true | true |
1c397d5a4701f90d305728e12748e4baba35860c | 151 | py | Python | SystemyMultimedialne/Lab07/tempCodeRunnerFile.py | arte00/informatyka | 642574f7c235d016b7a143a9957b26ddcaa09bee | [
"MIT"
] | null | null | null | SystemyMultimedialne/Lab07/tempCodeRunnerFile.py | arte00/informatyka | 642574f7c235d016b7a143a9957b26ddcaa09bee | [
"MIT"
] | null | null | null | SystemyMultimedialne/Lab07/tempCodeRunnerFile.py | arte00/informatyka | 642574f7c235d016b7a143a9957b26ddcaa09bee | [
"MIT"
] | null | null | null | sd.play(data[0:_max], samplerate=freq, blocking=True)
# sd.play(data1, samplerate=freq, blocking=True)
# sd.play(data2, samplerate=freq, blocking=True) | 50.333333 | 53 | 0.761589 | sd.play(data[0:_max], samplerate=freq, blocking=True)
| true | true |
1c397d6a6a1b5cda7f74f03891a7c53f87684eb5 | 52,992 | py | Python | pandas/tests/frame/test_reductions.py | k-fillmore/pandas | 67d4cae17bec45e84b9cf51bcf4fb5bbe293b26f | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 13 | 2015-04-09T06:21:18.000Z | 2021-02-06T05:08:09.000Z | pandas/tests/frame/test_reductions.py | k-fillmore/pandas | 67d4cae17bec45e84b9cf51bcf4fb5bbe293b26f | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 4 | 2016-01-15T13:49:34.000Z | 2016-07-04T20:52:50.000Z | pandas/tests/frame/test_reductions.py | k-fillmore/pandas | 67d4cae17bec45e84b9cf51bcf4fb5bbe293b26f | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 9 | 2015-04-06T06:35:47.000Z | 2019-07-10T23:53:29.000Z | from datetime import timedelta
from decimal import Decimal
from dateutil.tz import tzlocal
import numpy as np
import pytest
from pandas.compat import is_platform_windows
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Index,
MultiIndex,
S... | 35.446154 | 88 | 0.553744 | from datetime import timedelta
from decimal import Decimal
from dateutil.tz import tzlocal
import numpy as np
import pytest
from pandas.compat import is_platform_windows
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Index,
MultiIndex,
S... | true | true |
1c397d8363d117e09f5dbcb061e7fc8351cacae5 | 1,040 | py | Python | mys/transpiler/variables.py | Dogeek/mys | 193259a634c3ab1d9058b9ff79a0462ae86274b7 | [
"MIT"
] | null | null | null | mys/transpiler/variables.py | Dogeek/mys | 193259a634c3ab1d9058b9ff79a0462ae86274b7 | [
"MIT"
] | null | null | null | mys/transpiler/variables.py | Dogeek/mys | 193259a634c3ab1d9058b9ff79a0462ae86274b7 | [
"MIT"
] | null | null | null | class Variables:
"""A class that keeps track of which variables that are defined in all
branches, so that they can be used once they converges.
"""
def __init__(self):
self._first_add = True
self._local_variables = {}
def add_branch(self, variables):
"""Add all variables d... | 26 | 75 | 0.573077 | class Variables:
def __init__(self):
self._first_add = True
self._local_variables = {}
def add_branch(self, variables):
if self._first_add:
for name, info in variables.items():
self._local_variables[name] = info
self._first_add = False
... | true | true |
1c397ea5dd0698ae77e20b40aa0bbd6c2324ff82 | 245 | py | Python | dataformats/server_data.py | uuu0614/discordpy_util_bot | 56a3bae2caf1b351d91b5515c9052a4cc716f832 | [
"MIT"
] | 2 | 2021-08-13T07:06:50.000Z | 2021-08-13T07:23:48.000Z | dataformats/server_data.py | uuu0614/discordpy_util_bot | 56a3bae2caf1b351d91b5515c9052a4cc716f832 | [
"MIT"
] | null | null | null | dataformats/server_data.py | uuu0614/discordpy_util_bot | 56a3bae2caf1b351d91b5515c9052a4cc716f832 | [
"MIT"
] | 2 | 2020-10-31T13:52:54.000Z | 2021-08-13T07:07:25.000Z | class ServerData:
def __init__(self):
self._prefixes = ["u!"]
# サーバープレフィックス
@property
def prefixes(self):
return self._prefixes
@prefixes.setter
def prefixes(self, prefs):
self._prefixes = prefs
| 18.846154 | 31 | 0.608163 | class ServerData:
def __init__(self):
self._prefixes = ["u!"]
@property
def prefixes(self):
return self._prefixes
@prefixes.setter
def prefixes(self, prefs):
self._prefixes = prefs
| true | true |
1c397eae11cd62664355034206a4949502e8204d | 528 | py | Python | readthedocs/core/permissions.py | phoenixflyinghigh/readthedocs.org | 2dc1615c674b08c8b681ac3543fee913c9d90a11 | [
"MIT"
] | 2 | 2019-11-19T20:50:25.000Z | 2021-04-26T21:59:29.000Z | readthedocs/core/permissions.py | phoenixflyinghigh/readthedocs.org | 2dc1615c674b08c8b681ac3543fee913c9d90a11 | [
"MIT"
] | 12 | 2019-12-05T04:47:01.000Z | 2022-01-09T00:56:58.000Z | readthedocs/core/permissions.py | phoenixflyinghigh/readthedocs.org | 2dc1615c674b08c8b681ac3543fee913c9d90a11 | [
"MIT"
] | 1 | 2020-01-09T02:35:45.000Z | 2020-01-09T02:35:45.000Z | # -*- coding: utf-8 -*-
"""Objects for User permission checks."""
from readthedocs.core.utils.extend import SettingsOverrideObject
class AdminPermissionBase:
@classmethod
def is_admin(cls, user, project):
return user in project.users.all() or user.is_superuser
@classmethod
def is_member(cl... | 24 | 64 | 0.729167 |
from readthedocs.core.utils.extend import SettingsOverrideObject
class AdminPermissionBase:
@classmethod
def is_admin(cls, user, project):
return user in project.users.all() or user.is_superuser
@classmethod
def is_member(cls, user, obj):
return user in obj.users.all() or user.is_s... | true | true |
1c39817ceccba276386ffd7d3aeb8077d03f72dd | 12,588 | py | Python | wazimap/geo.py | CodeForAfricaLabs/wazimap | f3a756590f8067a48c5f3af7f848517053d859d8 | [
"MIT"
] | null | null | null | wazimap/geo.py | CodeForAfricaLabs/wazimap | f3a756590f8067a48c5f3af7f848517053d859d8 | [
"MIT"
] | 7 | 2018-08-21T12:38:30.000Z | 2019-02-26T06:21:54.000Z | wazimap/geo.py | CodeForAfricaLabs/wazimap | f3a756590f8067a48c5f3af7f848517053d859d8 | [
"MIT"
] | 1 | 2019-08-06T09:12:43.000Z | 2019-08-06T09:12:43.000Z | import os.path
import json
import logging
from itertools import chain
from django.conf import settings
from django.utils.module_loading import import_string
from django.db.models import Q
from django.contrib.staticfiles.storage import staticfiles_storage
from wazimap.models import Geography
log = logging.getLogger(_... | 37.688623 | 155 | 0.582936 | import os.path
import json
import logging
from itertools import chain
from django.conf import settings
from django.utils.module_loading import import_string
from django.db.models import Q
from django.contrib.staticfiles.storage import staticfiles_storage
from wazimap.models import Geography
log = logging.getLogger(_... | true | true |
1c3981d57b8b5192e94ebcd87abd51f7a5b55f8d | 1,289 | py | Python | autorooms/bot.py | alanissak320/autorooms | a4ff150ba263382e0bfc9849bed847f862ff996c | [
"MIT"
] | null | null | null | autorooms/bot.py | alanissak320/autorooms | a4ff150ba263382e0bfc9849bed847f862ff996c | [
"MIT"
] | null | null | null | autorooms/bot.py | alanissak320/autorooms | a4ff150ba263382e0bfc9849bed847f862ff996c | [
"MIT"
] | 1 | 2020-06-09T16:29:08.000Z | 2020-06-09T16:29:08.000Z | import logging
import discord
from discord.ext import commands
from discord.voice_client import VoiceClient
VoiceClient.warn_nacl = False
class ARBot(commands.AutoShardedBot):
"""
Autorooms bot
"""
def __init__(self, *args, initial_exts: tuple = None, **kwargs):
self.uptime = None
s... | 30.690476 | 81 | 0.643134 | import logging
import discord
from discord.ext import commands
from discord.voice_client import VoiceClient
VoiceClient.warn_nacl = False
class ARBot(commands.AutoShardedBot):
def __init__(self, *args, initial_exts: tuple = None, **kwargs):
self.uptime = None
self.initial_extensions = initial_e... | true | true |
1c3981ecbc3eb2c8ace42b9728f0a7df9a138614 | 237,626 | py | Python | tensorflow/python/ops/array_ops.py | mathemakitten/tensorflow | e62a6a8be2f9cfb79913bdb64f99efb5e88df0df | [
"Apache-2.0"
] | 1 | 2021-03-09T04:12:46.000Z | 2021-03-09T04:12:46.000Z | tensorflow/python/ops/array_ops.py | mathemakitten/tensorflow | e62a6a8be2f9cfb79913bdb64f99efb5e88df0df | [
"Apache-2.0"
] | null | null | null | tensorflow/python/ops/array_ops.py | mathemakitten/tensorflow | e62a6a8be2f9cfb79913bdb64f99efb5e88df0df | [
"Apache-2.0"
] | 1 | 2021-10-15T06:37:59.000Z | 2021-10-15T06:37:59.000Z | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 35.514273 | 129 | 0.633125 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numbers
import numpy as np
from tensorflow.python.eager import context
from tensorflow.python.framework import common_shapes
from tensorflow.python.framework import composite_tensor
from tensorflow.pyt... | true | true |
1c39835f2d752bd68ffb9c9f399f30231b3bf30e | 8,399 | py | Python | client_state_machine.py | hypedguy/Chat-System | 445e8967133ec9affd31cf3a0178d949be85347d | [
"MIT"
] | null | null | null | client_state_machine.py | hypedguy/Chat-System | 445e8967133ec9affd31cf3a0178d949be85347d | [
"MIT"
] | null | null | null | client_state_machine.py | hypedguy/Chat-System | 445e8967133ec9affd31cf3a0178d949be85347d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 5 00:00:32 2015
@author: zhengzhang
"""
from chat_utils import *
from configuredraycaster import dorender
import encoder
import json
import hashlib
from PIL import Image
class DummyThread:
def is_alive(self):
return False
def dostuff(socket, config, num, st... | 39.247664 | 101 | 0.434218 | from chat_utils import *
from configuredraycaster import dorender
import encoder
import json
import hashlib
from PIL import Image
class DummyThread:
def is_alive(self):
return False
def dostuff(socket, config, num, start, end):
comment, result= dorender(config, start=start,end=end)
print (result)
... | true | true |
1c398573bc12664f86422bc24fced85238c963a6 | 435 | py | Python | clean_db.json.py | usc-isi-i2/mydig-webservice | 9628f72fed9f33d0fe341c3d8c3324cb198aae74 | [
"MIT"
] | 2 | 2018-12-19T16:41:50.000Z | 2021-11-11T20:52:25.000Z | clean_db.json.py | research-software-company/mydig-webservice | 9628f72fed9f33d0fe341c3d8c3324cb198aae74 | [
"MIT"
] | 55 | 2017-06-09T15:53:56.000Z | 2018-04-16T23:53:30.000Z | clean_db.json.py | research-software-company/mydig-webservice | 9628f72fed9f33d0fe341c3d8c3324cb198aae74 | [
"MIT"
] | 12 | 2017-08-06T19:49:44.000Z | 2020-02-16T07:12:09.000Z | import json
from optparse import OptionParser
if __name__ == '__main__':
parser = OptionParser()
(c_options, args) = parser.parse_args()
input_path = args[0]
tld_to_remove = args[1]
db = json.load(open(input_path, 'r'))
dbo = open('db.json', 'w')
out = dict()
for k in db.keys():
... | 24.166667 | 43 | 0.593103 | import json
from optparse import OptionParser
if __name__ == '__main__':
parser = OptionParser()
(c_options, args) = parser.parse_args()
input_path = args[0]
tld_to_remove = args[1]
db = json.load(open(input_path, 'r'))
dbo = open('db.json', 'w')
out = dict()
for k in db.keys():
... | true | true |
1c39867a254f6ffc0d1528f327164f96587a0b71 | 9,697 | py | Python | EPImix_analysis/epimix_functions.py | frantisekvasa/epimix_rapid_processing | b4bc3cc8b2f473fd8f9538376b4ffbd6a5e9374f | [
"MIT"
] | null | null | null | EPImix_analysis/epimix_functions.py | frantisekvasa/epimix_rapid_processing | b4bc3cc8b2f473fd8f9538376b4ffbd6a5e9374f | [
"MIT"
] | null | null | null | EPImix_analysis/epimix_functions.py | frantisekvasa/epimix_rapid_processing | b4bc3cc8b2f473fd8f9538376b4ffbd6a5e9374f | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 13 10:38:35 2020
@author: Frantisek Vasa (fdv247@gmail.com)
Additional functions for manuscript "Rapid processing and quantitative evaluation of multicontrast EPImix scans for adaptive multimodal imaging"
"""
# Additional functions to run EPImix ... | 43.290179 | 269 | 0.643189 |
from wbplot import pscalar
import numpy as np
from matplotlib import cm, lines
import nibabel as nb
import nilearn as nl
import matplotlib as mpl
import matplotlib.pyplot as plt
import scipy as sp
def pow_10_fmt(p):
if p < 1e-10:
return 'P < $10^{-10}$'
elif p > 0.001:
return 'P = '+str(r... | true | true |
1c39873b51a9cef0ed9bb39b182792eaa9448ecd | 4,767 | py | Python | src/dev/hashing-algorithms.py | momacs/pram | d2de43ea447d13a65d814f781ec86889754f76fe | [
"BSD-3-Clause"
] | 10 | 2019-01-18T19:11:54.000Z | 2022-03-16T08:39:36.000Z | src/dev/hashing-algorithms.py | momacs/pram | d2de43ea447d13a65d814f781ec86889754f76fe | [
"BSD-3-Clause"
] | 2 | 2019-02-19T15:10:44.000Z | 2019-02-26T04:26:24.000Z | src/dev/hashing-algorithms.py | momacs/pram | d2de43ea447d13a65d814f781ec86889754f76fe | [
"BSD-3-Clause"
] | 3 | 2019-02-19T15:11:08.000Z | 2021-08-20T11:51:04.000Z | '''
Resources
Algorithms
https://github.com/ifduyue/python-xxhash
https://pypi.org/project/cityhash/
https://pypi.org/project/mmh3/
https://docs.python.org/3/library/zlib.html
Other
http://slidedeck.io/LawnGnome/non-cryptographic-hashing
'''
import cityhash,dill,inspect,... | 33.808511 | 120 | 0.57898 |
import cityhash,dill,inspect,json,mmh3,pickle,time,xxhash,zlib
import os,sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from pram.entity import Site
N = 100_000
attr = { 'flu': 's', 'age_group': '10_19', 'is_migrating': True, 't-migration': 3, 'history': [2,4,8.0] }
rel = { 'home': Site('home... | true | true |
1c3987a79dd744f9b321256a697b4990832a9bcf | 6,977 | py | Python | model.py | jessicapetrochuk/Detectron_2_Image_Segmentation | 67ab6fb03b90a298367c86eab0d89a2d8438169a | [
"MIT"
] | null | null | null | model.py | jessicapetrochuk/Detectron_2_Image_Segmentation | 67ab6fb03b90a298367c86eab0d89a2d8438169a | [
"MIT"
] | null | null | null | model.py | jessicapetrochuk/Detectron_2_Image_Segmentation | 67ab6fb03b90a298367c86eab0d89a2d8438169a | [
"MIT"
] | null | null | null | import torch
import natsort
import numpy as np
import pycocotools
from PIL import Image
import os, cv2, random
import torchvision.ops as ops
from detectron2 import model_zoo
from detectron2.config import get_cfg
from detectron2.structures import BoxMode
from detectron2.engine import DefaultTrainer
from detectron2.engin... | 44.724359 | 210 | 0.662606 | import torch
import natsort
import numpy as np
import pycocotools
from PIL import Image
import os, cv2, random
import torchvision.ops as ops
from detectron2 import model_zoo
from detectron2.config import get_cfg
from detectron2.structures import BoxMode
from detectron2.engine import DefaultTrainer
from detectron2.engin... | true | true |
1c39885591456c32596c53902fb5486d9dfc348f | 3,719 | py | Python | lib/modules/powershell/situational_awareness/network/reverse_dns.py | jimshew/Empire | a7413869849b2c3c521eb50bed61e00ede107688 | [
"BSD-3-Clause"
] | 4 | 2019-03-11T02:40:13.000Z | 2021-01-29T06:45:21.000Z | lib/modules/powershell/situational_awareness/network/reverse_dns.py | jimshew/Empire | a7413869849b2c3c521eb50bed61e00ede107688 | [
"BSD-3-Clause"
] | 20 | 2020-03-11T03:58:21.000Z | 2020-03-12T03:59:38.000Z | lib/modules/powershell/situational_awareness/network/reverse_dns.py | jimshew/Empire | a7413869849b2c3c521eb50bed61e00ede107688 | [
"BSD-3-Clause"
] | 1 | 2020-01-15T06:46:16.000Z | 2020-01-15T06:46:16.000Z | from __future__ import print_function
from builtins import str
from builtins import object
from lib.common import helpers
class Module(object):
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-ReverseDNSLookup',
'Author': ['DarkOperator'],
'Desc... | 36.821782 | 287 | 0.534015 | from __future__ import print_function
from builtins import str
from builtins import object
from lib.common import helpers
class Module(object):
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-ReverseDNSLookup',
'Author': ['DarkOperator'],
'Desc... | true | true |
1c398a7a4236e27807795af5ede3b107f993b6d7 | 2,593 | py | Python | uncertainty_baselines/models/vit_batchensemble_gp_test.py | dvdzhang/uncertainty-baselines | 8ce0d7494e5cae0719c1b750da4b61564e536636 | [
"Apache-2.0"
] | null | null | null | uncertainty_baselines/models/vit_batchensemble_gp_test.py | dvdzhang/uncertainty-baselines | 8ce0d7494e5cae0719c1b750da4b61564e536636 | [
"Apache-2.0"
] | null | null | null | uncertainty_baselines/models/vit_batchensemble_gp_test.py | dvdzhang/uncertainty-baselines | 8ce0d7494e5cae0719c1b750da4b61564e536636 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2022 The Uncertainty Baselines Authors.
#
# 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 ap... | 36.521127 | 79 | 0.650212 |
from absl.testing import absltest
from absl.testing import parameterized
import jax
import uncertainty_baselines as ub
class PatchTransformerBEGPTest(parameterized.TestCase):
@parameterized.parameters(
((4, 4), None, 10, None, (32, 32), "token"),
(None, (4, 4), 100, 64, (32, 64), "token"),
((4, ... | true | true |
1c398ab1ab8ac3cbd9c97a4f6f62bf4d989e441d | 1,181 | py | Python | eve_db/migrations/0002_system_check_fixes.py | EVE-Tools/django-eve-db | 1b588ed789a785d9243c2f2cd2ba0c965d36ba77 | [
"BSD-3-Clause"
] | 3 | 2015-03-05T20:49:27.000Z | 2017-05-27T17:53:00.000Z | eve_db/migrations/0002_system_check_fixes.py | EVE-Tools/django-eve-db | 1b588ed789a785d9243c2f2cd2ba0c965d36ba77 | [
"BSD-3-Clause"
] | 1 | 2018-01-20T10:06:05.000Z | 2018-01-20T10:08:58.000Z | eve_db/migrations/0002_system_check_fixes.py | EVE-Tools/django-eve-db | 1b588ed789a785d9243c2f2cd2ba0c965d36ba77 | [
"BSD-3-Clause"
] | 1 | 2015-02-27T17:18:42.000Z | 2015-02-27T17:18:42.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('eve_db', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='invmetatype',
name='ty... | 33.742857 | 143 | 0.635902 | from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('eve_db', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='invmetatype',
name='type',
field=m... | true | true |
1c398b26894a66dfc4bc630632f55b9f9bc52638 | 186 | py | Python | src/generator/hide.py | lambdacasserole/zero-width-js | 27aee94612afcebabc4db08b0b4d0a89661493ad | [
"Unlicense"
] | 4 | 2019-09-02T03:45:15.000Z | 2022-03-19T01:20:38.000Z | src/generator/hide.py | lambdacasserole/zero-width-js | 27aee94612afcebabc4db08b0b4d0a89661493ad | [
"Unlicense"
] | null | null | null | src/generator/hide.py | lambdacasserole/zero-width-js | 27aee94612afcebabc4db08b0b4d0a89661493ad | [
"Unlicense"
] | null | null | null | import sys
# Convert binary to zero-width string.
binary = sys.stdin.read()
lookup = {'0': '\u200b', '1': '\u200c', ' ': '\u200d'}
for char in binary:
print(lookup[char], end = '')
| 23.25 | 54 | 0.607527 | import sys
binary = sys.stdin.read()
lookup = {'0': '\u200b', '1': '\u200c', ' ': '\u200d'}
for char in binary:
print(lookup[char], end = '')
| true | true |
1c398c64bee725e08491bc10a6721b75e46eeae2 | 1,207 | py | Python | k8s/k8splugin/exceptions.py | onap/dcaegen2-platform-plugins | 64131311ba1d01ff7d20bca0c14d30a006b2e712 | [
"Apache-2.0",
"CC-BY-4.0"
] | 1 | 2020-07-14T14:22:04.000Z | 2020-07-14T14:22:04.000Z | k8s/k8splugin/exceptions.py | alex-sh2020/dcaegen2-platform-plugins | c5abb9b34468400bdcdd3ce23595af41ac03cd80 | [
"Apache-2.0",
"CC-BY-4.0"
] | null | null | null | k8s/k8splugin/exceptions.py | alex-sh2020/dcaegen2-platform-plugins | c5abb9b34468400bdcdd3ce23595af41ac03cd80 | [
"Apache-2.0",
"CC-BY-4.0"
] | 1 | 2020-07-14T19:02:05.000Z | 2020-07-14T19:02:05.000Z | # ============LICENSE_START=======================================================
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017-2020 AT&T Intellectual Property. All rights reserved.
# =============================================================... | 41.62069 | 82 | 0.570008 |
class DockerPluginDeploymentError(RuntimeError):
pass
class DockerPluginDependencyNotReadyError(RuntimeError):
pass
| true | true |
1c398c98d6cc4b33e1513064236da5cbc6ee025a | 3,643 | py | Python | pymongo/ismaster.py | llvtt/mongo-python-driver | 725f8342188e823ba90ab7d26e60e7a6bc43516a | [
"Apache-2.0"
] | null | null | null | pymongo/ismaster.py | llvtt/mongo-python-driver | 725f8342188e823ba90ab7d26e60e7a6bc43516a | [
"Apache-2.0"
] | null | null | null | pymongo/ismaster.py | llvtt/mongo-python-driver | 725f8342188e823ba90ab7d26e60e7a6bc43516a | [
"Apache-2.0"
] | null | null | null | # Copyright 2014 MongoDB, 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, so... | 30.107438 | 78 | 0.653033 |
import itertools
from bson.py3compat import imap
from pymongo import common
from pymongo.server_type import SERVER_TYPE
def _get_server_type(doc):
if not doc.get('ok'):
return SERVER_TYPE.Unknown
if doc.get('isreplicaset'):
return SERVER_TYPE.RSGhost
elif doc.get('setName'):
if... | true | true |
1c398d11e3763438d71bc763f8054aa15e33c5a5 | 13,392 | py | Python | dask/array/tests/test_ufunc.py | Juanlu001/dask | ba29ba377ae71e5a90fa5ef5198c7d317b45c06a | [
"BSD-3-Clause"
] | 1 | 2021-11-02T18:53:23.000Z | 2021-11-02T18:53:23.000Z | dask/array/tests/test_ufunc.py | Juanlu001/dask | ba29ba377ae71e5a90fa5ef5198c7d317b45c06a | [
"BSD-3-Clause"
] | 1 | 2021-10-07T09:57:58.000Z | 2021-10-07T09:57:58.000Z | dask/array/tests/test_ufunc.py | Juanlu001/dask | ba29ba377ae71e5a90fa5ef5198c7d317b45c06a | [
"BSD-3-Clause"
] | 1 | 2022-02-26T15:15:40.000Z | 2022-02-26T15:15:40.000Z | import pickle
from functools import partial
from operator import add
import pytest
np = pytest.importorskip("numpy")
import dask.array as da
from dask.array.ufunc import da_frompyfunc
from dask.array.utils import assert_eq
from dask.base import tokenize
DISCLAIMER = """
This docstring was copied from numpy.{name}.
... | 27.1643 | 85 | 0.62052 | import pickle
from functools import partial
from operator import add
import pytest
np = pytest.importorskip("numpy")
import dask.array as da
from dask.array.ufunc import da_frompyfunc
from dask.array.utils import assert_eq
from dask.base import tokenize
DISCLAIMER = """
This docstring was copied from numpy.{name}.
... | true | true |
1c398f576460ce9f02cb2595cad614379587e215 | 419 | py | Python | quantifiedcode/plugins/example/backend/tasks/test.py | marcinguy/scanmycode-ce | 4a5fa1e5e9c8450f5c84164f9fa1524115f65c8b | [
"BSD-3-Clause"
] | 138 | 2022-02-02T15:38:29.000Z | 2022-03-30T21:23:33.000Z | quantifiedcode/plugins/example/backend/tasks/test.py | bbbfkl/scanmycode-ce | 786ae9a83a0839b70ac773a673a3ac69a0484ee4 | [
"BSD-3-Clause"
] | 4 | 2022-02-07T04:51:55.000Z | 2022-03-31T03:40:10.000Z | quantifiedcode/plugins/example/backend/tasks/test.py | bbbfkl/scanmycode-ce | 786ae9a83a0839b70ac773a673a3ac69a0484ee4 | [
"BSD-3-Clause"
] | 16 | 2022-01-31T14:48:18.000Z | 2022-03-28T07:12:04.000Z | """
Contains tasks and helper functions to send notifications.
"""
import logging
import requests
import json
from quantifiedcode.settings import settings
from quantifiedcode.backend.worker import celery
logger = logging.getLogger(__name__)
@celery.task(time_limit=120, queue="email", ignore_result=False)
... | 16.115385 | 64 | 0.735084 |
import logging
import requests
import json
from quantifiedcode.settings import settings
from quantifiedcode.backend.worker import celery
logger = logging.getLogger(__name__)
@celery.task(time_limit=120, queue="email", ignore_result=False)
def test(webhook, template, template_context=None):
pass
| true | true |
1c39908d91c9003fdc6a0c1eba0de122ac737542 | 4,954 | py | Python | sam/utils/creds.py | stephanpieterse/sam-iam | 7c7c1a8fe8577f63fc6b91f7b8b1dbbaa88cf7a9 | [
"MIT"
] | null | null | null | sam/utils/creds.py | stephanpieterse/sam-iam | 7c7c1a8fe8577f63fc6b91f7b8b1dbbaa88cf7a9 | [
"MIT"
] | null | null | null | sam/utils/creds.py | stephanpieterse/sam-iam | 7c7c1a8fe8577f63fc6b91f7b8b1dbbaa88cf7a9 | [
"MIT"
] | 1 | 2021-08-06T07:48:46.000Z | 2021-08-06T07:48:46.000Z |
class AWSCreds:
def __init__(self, access_key, secret_key, session) -> None:
super().__init__()
self.session = session
self.secret_key = secret_key
self.access_key = access_key
def __get_act_from_arn(inp):
return inp.split(":")[4]
def __click_output(debug, echo_env, respon... | 38.703125 | 105 | 0.633024 |
class AWSCreds:
def __init__(self, access_key, secret_key, session) -> None:
super().__init__()
self.session = session
self.secret_key = secret_key
self.access_key = access_key
def __get_act_from_arn(inp):
return inp.split(":")[4]
def __click_output(debug, echo_env, respon... | true | true |
1c3990bf204221ef25520cc6750736b1380d5478 | 2,551 | py | Python | tests/test_rsvd.py | eldrin/aarms | bdd5455ac8dcfc1fe91a12fdd132b74e6c37609d | [
"MIT"
] | null | null | null | tests/test_rsvd.py | eldrin/aarms | bdd5455ac8dcfc1fe91a12fdd132b74e6c37609d | [
"MIT"
] | 3 | 2020-11-05T08:44:46.000Z | 2020-11-10T17:25:15.000Z | tests/test_rsvd.py | eldrin/aarms | bdd5455ac8dcfc1fe91a12fdd132b74e6c37609d | [
"MIT"
] | null | null | null | import unittest
import os
os.environ['NUMBA_NUM_THREADS'] = '1'
import numpy as np
from scipy import sparse as sp
from aarms.models.rsvd import RSVD, RSVDSPPMI
from aarms.models.transform import sppmi
from base_test import TestAARMS
class TestRSVD(TestAARMS):
"""
"""
def test_rsvd_factorize(self):
... | 33.12987 | 83 | 0.454332 | import unittest
import os
os.environ['NUMBA_NUM_THREADS'] = '1'
import numpy as np
from scipy import sparse as sp
from aarms.models.rsvd import RSVD, RSVDSPPMI
from aarms.models.transform import sppmi
from base_test import TestAARMS
class TestRSVD(TestAARMS):
def test_rsvd_factorize(self):
X = sp.csr_... | true | true |
1c3990d6a79fb17cb6131442f7acbe06d709de7e | 2,798 | py | Python | picoCTF-web/tests/integration/test_teams.py | minhnq1618/picoCTF | f634f0e55be6b1a8552a33e4f94e7487142e8bce | [
"MIT"
] | 280 | 2016-03-23T05:16:07.000Z | 2022-03-25T10:45:33.000Z | picoCTF-web/tests/integration/test_teams.py | minhnq1618/picoCTF | f634f0e55be6b1a8552a33e4f94e7487142e8bce | [
"MIT"
] | 384 | 2016-03-22T05:14:47.000Z | 2021-09-13T23:46:14.000Z | picoCTF-web/tests/integration/test_teams.py | minhnq1618/picoCTF | f634f0e55be6b1a8552a33e4f94e7487142e8bce | [
"MIT"
] | 142 | 2016-03-15T16:27:21.000Z | 2022-02-23T23:41:28.000Z | """Tests for the /api/v1/teams routes."""
from pytest_mongo import factories
from pytest_redis import factories
from .common import ( # noqa (fixture)
ADMIN_DEMOGRAPHICS,
clear_db,
client,
decode_response,
get_csrf_token,
register_test_accounts,
TEACHER_DEMOGRAPHICS,
STUDENT_DEMOGRAPHIC... | 32.534884 | 88 | 0.630808 | from pytest_mongo import factories
from pytest_redis import factories
from .common import ( ADMIN_DEMOGRAPHICS,
clear_db,
client,
decode_response,
get_csrf_token,
register_test_accounts,
TEACHER_DEMOGRAPHICS,
STUDENT_DEMOGRAPHICS,
get_conn,
)
def test_create_team(mongo_proc, redis... | true | true |
1c3990ef5c540d56a053816749da463b0e21a005 | 1,781 | py | Python | notebooks/relatorio.py | lbarosi/pylattes-lxml | 4de762f73a2086501ce06226ed04fb3c90fd9bd5 | [
"MIT"
] | null | null | null | notebooks/relatorio.py | lbarosi/pylattes-lxml | 4de762f73a2086501ce06226ed04fb3c90fd9bd5 | [
"MIT"
] | 1 | 2021-03-31T20:04:36.000Z | 2021-03-31T20:04:36.000Z | notebooks/relatorio.py | lbarosi/pylattes-lxml | 4de762f73a2086501ce06226ed04fb3c90fd9bd5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#!/usr/bin/env python
import os
import sys
import papermill as pm
from datetime import datetime as dt
import subprocess
import argparse
import warnings
warnings.filterwarnings("ignore")
def filename(nome):
inicio = dt.now().strftime('%d_%m_%Y_%M%S')
filename = 'RelatorioLattes-' + nome... | 26.191176 | 101 | 0.580573 | import os
import sys
import papermill as pm
from datetime import datetime as dt
import subprocess
import argparse
import warnings
warnings.filterwarnings("ignore")
def filename(nome):
inicio = dt.now().strftime('%d_%m_%Y_%M%S')
filename = 'RelatorioLattes-' + nome + '_' + inicio + '.ipynb'
return filename... | true | true |
1c3991a4e576ccab340e3cc85f2ae2739e0b1392 | 370 | py | Python | template_project/settings.py | makspll/django-starter-template | f200d7c1626d74e0921cdfbced9040ee866ac2c1 | [
"MIT"
] | null | null | null | template_project/settings.py | makspll/django-starter-template | f200d7c1626d74e0921cdfbced9040ee866ac2c1 | [
"MIT"
] | 5 | 2021-03-30T14:21:46.000Z | 2021-09-22T19:41:59.000Z | template_project/settings.py | makspll/django-starter-template | f200d7c1626d74e0921cdfbced9040ee866ac2c1 | [
"MIT"
] | null | null | null | from split_settings.tools import optional, include
import os
ENV = os.environ.get("ENV_NAME",'dev')
BASE_SETTINGS = [
'components/common.py',
'components/languages.py',
'components/database.py',
'components/media.py',
'components/static.py',
'environments/{0}.py'.format(ENV),
optional('en... | 21.764706 | 50 | 0.691892 | from split_settings.tools import optional, include
import os
ENV = os.environ.get("ENV_NAME",'dev')
BASE_SETTINGS = [
'components/common.py',
'components/languages.py',
'components/database.py',
'components/media.py',
'components/static.py',
'environments/{0}.py'.format(ENV),
optional('en... | true | true |
1c3993eff7688207d56ccb8949d6ea2a04de9d4e | 908 | py | Python | setup.py | aabversteeg/simpleeval | 7999fd7d5c3928485b4633f5f93ab72931823fa5 | [
"MIT"
] | null | null | null | setup.py | aabversteeg/simpleeval | 7999fd7d5c3928485b4633f5f93ab72931823fa5 | [
"MIT"
] | null | null | null | setup.py | aabversteeg/simpleeval | 7999fd7d5c3928485b4633f5f93ab72931823fa5 | [
"MIT"
] | null | null | null | from setuptools import setup
__version__ = '0.9.5'
setup(
name='simpleeval',
py_modules=['simpleeval'],
version=__version__,
description='A simple, safe single expression evaluator library.',
long_description=open('README.rst', 'r').read(),
author='Daniel Fairhead',
author_email='danthedec... | 36.32 | 85 | 0.629956 | from setuptools import setup
__version__ = '0.9.5'
setup(
name='simpleeval',
py_modules=['simpleeval'],
version=__version__,
description='A simple, safe single expression evaluator library.',
long_description=open('README.rst', 'r').read(),
author='Daniel Fairhead',
author_email='danthedec... | true | true |
1c3994837f7bebf72235a21ddad66c5db7a1d511 | 877 | py | Python | setup.py | ExCiteS/geokey-airquality | 1c29351fa77a4ac1d834bbd1bb25b21ebb1dc57a | [
"MIT"
] | 1 | 2016-01-13T15:19:09.000Z | 2016-01-13T15:19:09.000Z | setup.py | ExCiteS/geokey-airquality | 1c29351fa77a4ac1d834bbd1bb25b21ebb1dc57a | [
"MIT"
] | 2 | 2015-12-08T14:33:07.000Z | 2018-09-20T10:01:07.000Z | setup.py | ExCiteS/geokey-airquality | 1c29351fa77a4ac1d834bbd1bb25b21ebb1dc57a | [
"MIT"
] | 1 | 2018-10-16T11:40:04.000Z | 2018-10-16T11:40:04.000Z | #!/usr/bin/env python
"""GeoKey extension for Air Quality functionality."""
from os.path import dirname, join
from setuptools import setup, find_packages
def read(file_name):
with open(join(dirname(__file__), file_name)) as file_object:
return file_object.read()
name = 'geokey-airquality'
version = __... | 27.40625 | 72 | 0.705815 |
from os.path import dirname, join
from setuptools import setup, find_packages
def read(file_name):
with open(join(dirname(__file__), file_name)) as file_object:
return file_object.read()
name = 'geokey-airquality'
version = __import__(name.replace('-', '_')).__version__
repository = join('https://gith... | true | true |
1c3995166b14f0ac8c3c1dec2f8d8366704ebf20 | 3,141 | py | Python | setup.py | c-l-nguyen/pantab | b3602815232928e59ee85bae3f35cd204dd4f06d | [
"BSD-3-Clause"
] | 1 | 2020-10-12T13:35:56.000Z | 2020-10-12T13:35:56.000Z | setup.py | mhadi813/pantab | f5267c23fb06b9a7f0b7b03c98d67148c0e3058d | [
"BSD-3-Clause"
] | null | null | null | setup.py | mhadi813/pantab | f5267c23fb06b9a7f0b7b03c98d67148c0e3058d | [
"BSD-3-Clause"
] | null | null | null | import os
import sys
from setuptools import Extension, find_packages, setup
try:
from tableauhyperapi.impl.util import find_hyper_api_dll
except ImportError: # renamed in version 0.0.10309
from tableauhyperapi.impl.util import find_hyper_api_library as find_hyper_api_dll
here = os.path.abspath(os.path.dirn... | 32.381443 | 86 | 0.672079 | import os
import sys
from setuptools import Extension, find_packages, setup
try:
from tableauhyperapi.impl.util import find_hyper_api_dll
except ImportError: from tableauhyperapi.impl.util import find_hyper_api_library as find_hyper_api_dll
here = os.path.abspath(os.path.dirname(__file__))
dll_path = find_... | true | true |
1c3998313b8fbf3777d549c3a2945f1360c694e7 | 1,161 | py | Python | var/spack/repos/builtin/packages/libxfont2/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 11 | 2015-10-04T02:17:46.000Z | 2018-02-07T18:23:00.000Z | var/spack/repos/builtin/packages/libxfont2/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 22 | 2017-08-01T22:45:10.000Z | 2022-03-10T07:46:31.000Z | var/spack/repos/builtin/packages/libxfont2/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 4 | 2016-06-10T17:57:39.000Z | 2018-09-11T04:59:38.000Z | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libxfont2(AutotoolsPackage, XorgPackage):
"""libXfont provides the core of the legacy X11 ... | 38.7 | 95 | 0.727821 |
from spack import *
class Libxfont2(AutotoolsPackage, XorgPackage):
homepage = "https://cgit.freedesktop.org/xorg/lib/libXfont"
xorg_mirror_path = "lib/libXfont2-2.0.1.tar.gz"
version('2.0.1', sha256='381b6b385a69343df48a082523c856aed9042fbbc8ee0a6342fb502e4321230a')
depends_on('libfontenc')
d... | true | true |
1c3998d4f906c41b8a647bc9aaa38e6d1ca78881 | 1,883 | py | Python | integration-tests/generate_data_coassembly_command.py | luispedro/SemiBin | 7a5c9c68bb29ec27b64d7b34ed88a2eab921314b | [
"MIT"
] | 25 | 2021-05-19T15:38:30.000Z | 2022-03-18T09:28:32.000Z | integration-tests/generate_data_coassembly_command.py | luispedro/SemiBin | 7a5c9c68bb29ec27b64d7b34ed88a2eab921314b | [
"MIT"
] | 39 | 2021-05-12T05:22:26.000Z | 2022-03-31T13:28:46.000Z | integration-tests/generate_data_coassembly_command.py | luispedro/SemiBin | 7a5c9c68bb29ec27b64d7b34ed88a2eab921314b | [
"MIT"
] | 5 | 2021-03-15T23:08:00.000Z | 2021-05-07T07:31:03.000Z | import os
import pandas as pd
import subprocess
### Input fa
subprocess.check_call('SemiBin generate_data_single -i test/coassembly_sample_data/input.fasta -o output_coassembly_fa -m 2500 --ratio 0.05 --ml-threshold 4000 -p 1 -b test/coassembly_sample_data/input.sorted*.bam', shell=True)
data = pd.read_csv('output_c... | 44.833333 | 232 | 0.774827 | import os
import pandas as pd
import subprocess
subprocess.check_call('SemiBin generate_data_single -i test/coassembly_sample_data/input.fasta -o output_coassembly_fa -m 2500 --ratio 0.05 --ml-threshold 4000 -p 1 -b test/coassembly_sample_data/input.sorted*.bam', shell=True)
data = pd.read_csv('output_coassembly_fa/... | true | true |
1c3998dcd1f7fb374c19e7b1d43b9ea62225f6df | 711 | py | Python | leetcode/palindrome_number_without_string.py | abhik-93/python | db8dd0b8731f3687a5d0c7bf32b7ffe740569104 | [
"MIT"
] | null | null | null | leetcode/palindrome_number_without_string.py | abhik-93/python | db8dd0b8731f3687a5d0c7bf32b7ffe740569104 | [
"MIT"
] | null | null | null | leetcode/palindrome_number_without_string.py | abhik-93/python | db8dd0b8731f3687a5d0c7bf32b7ffe740569104 | [
"MIT"
] | null | null | null | class Solution(object):
def convertInttoList(self, n):
l = []
while n != 0:
l = [n % 10] + l
n = n // 10
return l
def isPalindrome(self, x):
if x <= 2**31 -1 and x>= -2**31:
if x>0:
x = Solution().convertInttoList(x)
... | 27.346154 | 80 | 0.524613 | class Solution(object):
def convertInttoList(self, n):
l = []
while n != 0:
l = [n % 10] + l
n = n // 10
return l
def isPalindrome(self, x):
if x <= 2**31 -1 and x>= -2**31:
if x>0:
x = Solution().convertInttoList(x)
... | true | true |
1c3998e6be14a17b2323d453ae57a027cf8058e9 | 1,494 | py | Python | classification/prepare_data.py | HuadingLing/astnn | 64fb02666245387d7aee80364ea4d421feb1594e | [
"MIT"
] | null | null | null | classification/prepare_data.py | HuadingLing/astnn | 64fb02666245387d7aee80364ea4d421feb1594e | [
"MIT"
] | null | null | null | classification/prepare_data.py | HuadingLing/astnn | 64fb02666245387d7aee80364ea4d421feb1594e | [
"MIT"
] | null | null | null | from pycparser import c_parser, c_ast
import pandas as pd
import os
import re
import sys
from gensim.models.word2vec import Word2Vec
import pickle
from tree import ASTNode, SingleNode
import numpy as np
def get_sequences(node, sequence):
current = SingleNode(node)
sequence.append(current.get_token())
for ... | 18.675 | 104 | 0.603079 | from pycparser import c_parser, c_ast
import pandas as pd
import os
import re
import sys
from gensim.models.word2vec import Word2Vec
import pickle
from tree import ASTNode, SingleNode
import numpy as np
def get_sequences(node, sequence):
current = SingleNode(node)
sequence.append(current.get_token())
for ... | true | true |
1c399a2d888171b25618f23f1c90aecc6fe52b0c | 308 | py | Python | agape/organizations/urls.py | codewiseio/django-agape | a63fc2cc63776c2b2cb16c7f6aee64f5783c3bba | [
"MIT"
] | null | null | null | agape/organizations/urls.py | codewiseio/django-agape | a63fc2cc63776c2b2cb16c7f6aee64f5783c3bba | [
"MIT"
] | null | null | null | agape/organizations/urls.py | codewiseio/django-agape | a63fc2cc63776c2b2cb16c7f6aee64f5783c3bba | [
"MIT"
] | null | null | null | from django.conf.urls import url, include
from .views import OrganizationViewSet
# build router
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'organizations', OrganizationViewSet, base_name='organizations')
urlpatterns = [
url(r'^',include(router.urls)),
] | 25.666667 | 81 | 0.788961 | from django.conf.urls import url, include
from .views import OrganizationViewSet
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'organizations', OrganizationViewSet, base_name='organizations')
urlpatterns = [
url(r'^',include(router.urls)),
] | true | true |
1c399c304ad15e29c7a808c06d887482964fccc3 | 712 | py | Python | easy_time_tracker/constants.py | btr1975/easy-time-tracker | 3889913844b41a6da55a8b1aa1721a9873349bf6 | [
"MIT"
] | null | null | null | easy_time_tracker/constants.py | btr1975/easy-time-tracker | 3889913844b41a6da55a8b1aa1721a9873349bf6 | [
"MIT"
] | null | null | null | easy_time_tracker/constants.py | btr1975/easy-time-tracker | 3889913844b41a6da55a8b1aa1721a9873349bf6 | [
"MIT"
] | null | null | null | """
Constants for easy_time_tracker
"""
import os
from pathlib import Path
# The absolute path to the easy-time-tracker directory
EASY_TIME_TRACKER_BASE_PATH = os.path.split(os.path.split(os.path.abspath(__file__))[0])[0]
# The name to use for the current record
EASY_TIME_TRACKER_CURRENT_RECORD = os.getenv('EASY_TIME_... | 47.466667 | 115 | 0.710674 | import os
from pathlib import Path
EASY_TIME_TRACKER_BASE_PATH = os.path.split(os.path.split(os.path.abspath(__file__))[0])[0]
EASY_TIME_TRACKER_CURRENT_RECORD = os.getenv('EASY_TIME_TRACKER_CURRENT_RECORD') or \
os.path.join(Path.home(), 'easy-time-tracker-data', 'current_record.jso... | true | true |
1c399d3ece99d61b605cd8d1d1e3f9156903cc35 | 6,130 | py | Python | src/generative/modify_attribute.py | rajivmanivannan/facenet | 4a896201dba3f8caf64ba4d5004d60eaf9aefd78 | [
"MIT"
] | null | null | null | src/generative/modify_attribute.py | rajivmanivannan/facenet | 4a896201dba3f8caf64ba4d5004d60eaf9aefd78 | [
"MIT"
] | null | null | null | src/generative/modify_attribute.py | rajivmanivannan/facenet | 4a896201dba3f8caf64ba4d5004d60eaf9aefd78 | [
"MIT"
] | 1 | 2020-03-03T05:44:19.000Z | 2020-03-03T05:44:19.000Z | # MIT License
#
# Copyright (c) 2017 David Sandberg
#
# 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, me... | 42.867133 | 145 | 0.684502 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import sys
import argparse
import importlib
import facenet
import os
import numpy as np
import h5py
import math
from scipy import misc
def main(args):
img_mean = np.array([134.1... | true | true |
1c399daeface1f28ecc2913fe550bc3ecf8af487 | 3,159 | py | Python | tests/bugs/core_1550_postfix_test.py | FirebirdSQL/firebird-qa | 96af2def7f905a06f178e2a80a2c8be4a4b44782 | [
"MIT"
] | 1 | 2022-02-05T11:37:13.000Z | 2022-02-05T11:37:13.000Z | tests/bugs/core_1550_postfix_test.py | FirebirdSQL/firebird-qa | 96af2def7f905a06f178e2a80a2c8be4a4b44782 | [
"MIT"
] | 1 | 2021-09-03T11:47:00.000Z | 2021-09-03T12:42:10.000Z | tests/bugs/core_1550_postfix_test.py | FirebirdSQL/firebird-qa | 96af2def7f905a06f178e2a80a2c8be4a4b44782 | [
"MIT"
] | 1 | 2021-06-30T14:14:16.000Z | 2021-06-30T14:14:16.000Z | #coding:utf-8
#
# id: bugs.core_1550_postfix
# title: Unnecessary index scan happens when the same index is mapped to both WHERE and ORDER BY clauses
# decription:
# http://sourceforge.net/p/firebird/code/60368
# Date: 2014-12-16 11:40:42 +0000 (Tue, 16 Dec 2014)
... | 30.085714 | 121 | 0.550174 |
import pytest
from firebird.qa import db_factory, isql_act, Action
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
-- sent to dimitr 30.09.14 at 22:09
set term ^;
execute block as
begin
execute statement 'drop sequence g'... | true | true |
1c399e484c6ee4793096c73639f63547f98ded20 | 774 | py | Python | accounts/permissions.py | mnpenchev/DocManSys_django_rest | 6b6a9be55d7bb1d44d887649aae69efbd000444d | [
"MIT"
] | null | null | null | accounts/permissions.py | mnpenchev/DocManSys_django_rest | 6b6a9be55d7bb1d44d887649aae69efbd000444d | [
"MIT"
] | null | null | null | accounts/permissions.py | mnpenchev/DocManSys_django_rest | 6b6a9be55d7bb1d44d887649aae69efbd000444d | [
"MIT"
] | null | null | null | from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
""" allows user to update their own profile """
def has_object_permission(self, request, view, obj):
""" check if user is trying to edit their own proffile """
if request.method in permissions.SAFE_MET... | 32.25 | 69 | 0.674419 | from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_METHODS:
return True
return obj.id == request.user.id
| true | true |
1c399f3f1011ac9707c0ce8570cb1153117e1986 | 2,083 | py | Python | scripts/data_convert/filter_queries.py | prateeksingh0001/FlexNeuART | ebc82ca4fe01436374c595db2429bc49fb9e1dd0 | [
"Apache-2.0"
] | null | null | null | scripts/data_convert/filter_queries.py | prateeksingh0001/FlexNeuART | ebc82ca4fe01436374c595db2429bc49fb9e1dd0 | [
"Apache-2.0"
] | null | null | null | scripts/data_convert/filter_queries.py | prateeksingh0001/FlexNeuART | ebc82ca4fe01436374c595db2429bc49fb9e1dd0 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Filtering queries to exclude queries that might textually match queries from a set of sub-directories
import sys
import os
import json
import argparse
sys.path.append('.')
from scripts.data_convert.convert_common import FileWrapper, read_queries
from scripts.config import TEXT_FIELD_NAME, QUES... | 31.560606 | 111 | 0.707633 | import sys
import os
import json
import argparse
sys.path.append('.')
from scripts.data_convert.convert_common import FileWrapper, read_queries
from scripts.config import TEXT_FIELD_NAME, QUESTION_FILE_JSON
parser = argparse.ArgumentParser(description='Filter queries to exclude queries from given sub-directories')
p... | true | true |
1c399fadb353613479b7f9eb7478ded5c5946060 | 3,460 | py | Python | src/db-up/azext_db_up/vendored_sdks/azure_mgmt_sql/sql/models/server.py | Mannan2812/azure-cli-extensions | e2b34efe23795f6db9c59100534a40f0813c3d95 | [
"MIT"
] | 207 | 2017-11-29T06:59:41.000Z | 2022-03-31T10:00:53.000Z | src/db-up/azext_db_up/vendored_sdks/azure_mgmt_sql/sql/models/server.py | Mannan2812/azure-cli-extensions | e2b34efe23795f6db9c59100534a40f0813c3d95 | [
"MIT"
] | 4,061 | 2017-10-27T23:19:56.000Z | 2022-03-31T23:18:30.000Z | src/db-up/azext_db_up/vendored_sdks/azure_mgmt_sql/sql/models/server.py | Mannan2812/azure-cli-extensions | e2b34efe23795f6db9c59100534a40f0813c3d95 | [
"MIT"
] | 802 | 2017-10-11T17:36:26.000Z | 2022-03-31T22:24:32.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 39.770115 | 104 | 0.619942 |
from .tracked_resource import TrackedResource
class Server(TrackedResource):
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'kind': {'readonly': True},
'state': {'readonly': True},
... | true | true |
1c399ff53065a5193a230224651211ff389cc86d | 1,171 | py | Python | TUI/Inst/BOSS/TestData.py | sdss/snafui | 0793b036122755396f06f449080d9cdad7d508ec | [
"BSD-3-Clause"
] | 1 | 2018-03-07T02:47:36.000Z | 2018-03-07T02:47:36.000Z | TUI/Inst/BOSS/TestData.py | sdss/snafui | 0793b036122755396f06f449080d9cdad7d508ec | [
"BSD-3-Clause"
] | null | null | null | TUI/Inst/BOSS/TestData.py | sdss/snafui | 0793b036122755396f06f449080d9cdad7d508ec | [
"BSD-3-Clause"
] | null | null | null | import TUI.Base.TestDispatcher
testDispatcher = TUI.Base.TestDispatcher.TestDispatcher("boss", delay=1.0)
tuiModel = testDispatcher.tuiModel
ExposeMainDataList = (
"exposureState=IDLE, 0, 0",
"hardwareStatus=0x38",
"shutterStatus=0x1, 0x1",
"screenStatus=0x5, 0x5",
"motorPosition=5000, 4800, 5200,... | 20.54386 | 74 | 0.614859 | import TUI.Base.TestDispatcher
testDispatcher = TUI.Base.TestDispatcher.TestDispatcher("boss", delay=1.0)
tuiModel = testDispatcher.tuiModel
ExposeMainDataList = (
"exposureState=IDLE, 0, 0",
"hardwareStatus=0x38",
"shutterStatus=0x1, 0x1",
"screenStatus=0x5, 0x5",
"motorPosition=5000, 4800, 5200,... | true | true |
1c39a02fd23ef778076844212fc5039acb5837e0 | 1,902 | py | Python | mil_common/utils/mil_tools/mil_misc_tools/serial_tools.py | RishiKumarRay/mil | f3746a91e68aac713e86b380cdda8852ba826170 | [
"MIT"
] | 27 | 2020-02-17T21:54:09.000Z | 2022-03-18T17:49:23.000Z | mil_common/utils/mil_tools/mil_misc_tools/serial_tools.py | RishiKumarRay/mil | f3746a91e68aac713e86b380cdda8852ba826170 | [
"MIT"
] | 325 | 2019-09-11T14:13:56.000Z | 2022-03-31T00:38:30.000Z | mil_common/utils/mil_tools/mil_misc_tools/serial_tools.py | RishiKumarRay/mil | f3746a91e68aac713e86b380cdda8852ba826170 | [
"MIT"
] | 24 | 2019-09-16T00:29:45.000Z | 2022-03-06T10:56:38.000Z | #!/usr/bin/env python
import serial
def hexify(buff):
'''
Print a string displaying the bytes in hex format
example: hexify(my_packet) -> c0:14:09:48:45:4c:4c:4f:c1
'''
return ':'.join(b.encode('hex') for b in buff)
class NoopSerial(serial.Serial):
'''
Inherits from serial.Serial, doing ... | 21.133333 | 107 | 0.627234 | import serial
def hexify(buff):
return ':'.join(b.encode('hex') for b in buff)
class NoopSerial(serial.Serial):
port = 'noop-serial'
def __init__(*args, **kwargs):
pass
def open(self):
pass
@property
def in_waiting(self):
return 0
@property
def out_waiting... | true | true |
1c39a0fcb46e2f61334de27052d82344b2c58d05 | 1,983 | py | Python | longest_common_subsequence_print_alt.py | tusharsadhwani/leetcode | a17a8a7587c5654f05fcd13ae7cdf47263ab2ea8 | [
"MIT"
] | 6 | 2021-05-21T01:10:42.000Z | 2021-12-16T16:12:30.000Z | longest_common_subsequence_print_alt.py | tusharsadhwani/leetcode | a17a8a7587c5654f05fcd13ae7cdf47263ab2ea8 | [
"MIT"
] | null | null | null | longest_common_subsequence_print_alt.py | tusharsadhwani/leetcode | a17a8a7587c5654f05fcd13ae7cdf47263ab2ea8 | [
"MIT"
] | null | null | null | from collections import defaultdict
# Printing the largest subsequence using the alt-Solution, without storing strings
class Solution:
def longestCommonSubsequence(self, text1: str, text2: str) -> str:
cache: defaultdict[int, defaultdict[int, int]] = defaultdict(lambda: defaultdict(int))
for inde... | 30.984375 | 94 | 0.520424 | from collections import defaultdict
class Solution:
def longestCommonSubsequence(self, text1: str, text2: str) -> str:
cache: defaultdict[int, defaultdict[int, int]] = defaultdict(lambda: defaultdict(int))
for index1, char1 in enumerate(text1, start=1):
for index2, char2 in enumerate(... | true | true |
1c39a128187cb933b60c03ad0668631ab0287fb1 | 16,795 | py | Python | cspace/main/ui/Ui_MainWindow.py | jmcvetta/cspace | 13d6be86dfa3417ac5511b1b2c15d1050fe3701d | [
"RSA-MD",
"TCP-wrappers"
] | 28 | 2015-04-24T12:04:08.000Z | 2022-01-07T15:13:10.000Z | cspace/main/ui/Ui_MainWindow.py | Magnus167/cspace | 13d6be86dfa3417ac5511b1b2c15d1050fe3701d | [
"RSA-MD",
"TCP-wrappers"
] | 1 | 2015-12-09T10:21:59.000Z | 2015-12-16T05:38:55.000Z | cspace/main/ui/Ui_MainWindow.py | Magnus167/cspace | 13d6be86dfa3417ac5511b1b2c15d1050fe3701d | [
"RSA-MD",
"TCP-wrappers"
] | 18 | 2015-01-01T02:16:49.000Z | 2021-08-12T04:14:57.000Z | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MainWindow.ui'
#
# Created: Mon Oct 09 13:21:16 2006
# by: PyQt4 UI code generator 4.0.1
#
# WARNING! All changes made in this file will be lost!
import sys
from PyQt4 import QtCore, QtGui
class Ui_MainWindow(object):
... | 55.612583 | 721 | 0.718488 |
import sys
from PyQt4 import QtCore, QtGui
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(QtCore.QSize(QtCore.QRect(0,0,283,376).size()).expandedTo(MainWindow.minimumSizeHint()))
MainWindow.setWindowIcon(QtGui.... | true | true |
1c39a329a1861e2a4b9086d9ce7bc0ccd9a2eb57 | 5,152 | py | Python | src/ebel_rest/manager/statistics.py | e-BE-L/ebel_rest | 67e62fe0d52eb9cd5dba333e2908e5746e4317e7 | [
"MIT"
] | 3 | 2020-04-22T11:16:43.000Z | 2021-09-28T13:49:18.000Z | src/ebel_rest/manager/statistics.py | e-BE-L/ebel_rest | 67e62fe0d52eb9cd5dba333e2908e5746e4317e7 | [
"MIT"
] | null | null | null | src/ebel_rest/manager/statistics.py | e-BE-L/ebel_rest | 67e62fe0d52eb9cd5dba333e2908e5746e4317e7 | [
"MIT"
] | null | null | null | from collections import Counter
import pandas as pd
from ebel_rest.manager.core import Statistics
from ebel_rest.manager import ss_functions
def summarize() -> Statistics:
"""Returns summary statistics on the graph."""
return Statistics().apply_api_function(ss_functions.BEL_STATISTICS_SUMMARIZE)
def publi... | 39.328244 | 116 | 0.722826 | from collections import Counter
import pandas as pd
from ebel_rest.manager.core import Statistics
from ebel_rest.manager import ss_functions
def summarize() -> Statistics:
return Statistics().apply_api_function(ss_functions.BEL_STATISTICS_SUMMARIZE)
def publication_by_year() -> Statistics:
return Statisti... | true | true |
1c39a57b6f5ec4a1121a1d80e025e2c081812e38 | 1,779 | py | Python | sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/network_interface_py3.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 8 | 2021-01-13T23:44:08.000Z | 2021-03-17T10:13:36.000Z | sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/network_interface_py3.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 226 | 2019-07-24T07:57:21.000Z | 2019-10-15T01:07:24.000Z | sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/network_interface_py3.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 2 | 2020-05-21T22:51:22.000Z | 2020-05-26T20:53:01.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 34.882353 | 76 | 0.609893 |
from msrest.serialization import Model
class NetworkInterface(Model):
_validation = {
'private_ip_address': {'readonly': True},
'ssh_authority': {'readonly': True},
'rdp_authority': {'readonly': True},
'username': {'readonly': True},
}
_attribute_map = {
'private... | true | true |
1c39a6a1da67e5ad4c9b2e539886f9b75b87bfe1 | 2,455 | py | Python | Chapter15/Using PostgreSQL in Python applications/sqlalchemy_orm.py | MLikeWater/Learning-PostgreSQL-11-Third-Edition | 6f4414c2a0edb1bc0e280ca4d1589b89b7205671 | [
"MIT"
] | 19 | 2019-01-30T14:12:27.000Z | 2021-10-05T19:45:42.000Z | Chapter15/Using PostgreSQL in Python applications/sqlalchemy_orm.py | PacktPublishing/Learning-PostgreSQL-11-Third-Edition | 134ad3efd3b1f3bd491daf1d145676e0977b9d8e | [
"MIT"
] | null | null | null | Chapter15/Using PostgreSQL in Python applications/sqlalchemy_orm.py | PacktPublishing/Learning-PostgreSQL-11-Third-Edition | 134ad3efd3b1f3bd491daf1d145676e0977b9d8e | [
"MIT"
] | 21 | 2018-11-20T11:44:50.000Z | 2022-01-19T21:19:38.000Z | #!/usr/bin/python3
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
engine = create_engine(
"postgresql+pg8000://car_portal_app@localhost/car_portal",
echo=False)
Base = declarative_base()
Session = sessionmaker(bind=engine... | 29.939024 | 79 | 0.672912 |
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
engine = create_engine(
"postgresql+pg8000://car_portal_app@localhost/car_portal",
echo=False)
Base = declarative_base()
Session = sessionmaker(bind=engine)
class Car_model... | true | true |
1c39a6a43a52b34276fae2d57bc088da4f6d8c5e | 698 | py | Python | wangzhansen/20180409/20180409h4.py | python20180319howmework/homework | c826d7aa4c52f8d22f739feb134d20f0b2c217cd | [
"Apache-2.0"
] | null | null | null | wangzhansen/20180409/20180409h4.py | python20180319howmework/homework | c826d7aa4c52f8d22f739feb134d20f0b2c217cd | [
"Apache-2.0"
] | null | null | null | wangzhansen/20180409/20180409h4.py | python20180319howmework/homework | c826d7aa4c52f8d22f739feb134d20f0b2c217cd | [
"Apache-2.0"
] | null | null | null | '''
4.现有两个进程,1号进程向文件写入10个"hello" 2号进程向文件写入10个"world",两个进程并发执行
如何使得文件中的内容一定是"hellohellohellohellohello.....worldworldworld......."
'''
from multiprocessing import Process, Pool, Lock
import os
def newprocess(flname, mylock):
with mylock:
f = open(flname,"r+")
fistline = f.readline()
fistline... | 27.92 | 73 | 0.611748 | from multiprocessing import Process, Pool, Lock
import os
def newprocess(flname, mylock):
with mylock:
f = open(flname,"r+")
fistline = f.readline()
fistline = str("hello" * 10)
f.seek(0,0)
f.write(fistline)
f.close()
if __name__ == '__main__':
f = open("./yourp... | true | true |
1c39a74be9aad9519c7a6d386c62be44d4926b3c | 848 | py | Python | nessus/file.py | tharvik/nessus | 4551c319ac6cb3026ddb096a0f6f71f060a578ab | [
"CC0-1.0"
] | null | null | null | nessus/file.py | tharvik/nessus | 4551c319ac6cb3026ddb096a0f6f71f060a578ab | [
"CC0-1.0"
] | null | null | null | nessus/file.py | tharvik/nessus | 4551c319ac6cb3026ddb096a0f6f71f060a578ab | [
"CC0-1.0"
] | null | null | null | from uuid import uuid4
from nessus.base import LibNessusBase
class NessusFile:
def __init__(self, path: str) -> None:
self.path = path
class NessusRemoteFile:
def __init__(self, name: str) -> None:
self.name = name
class LibNessusFile(LibNessusBase):
def upload(self, nessus_file: Ness... | 26.5 | 73 | 0.615566 | from uuid import uuid4
from nessus.base import LibNessusBase
class NessusFile:
def __init__(self, path: str) -> None:
self.path = path
class NessusRemoteFile:
def __init__(self, name: str) -> None:
self.name = name
class LibNessusFile(LibNessusBase):
def upload(self, nessus_file: Ness... | true | true |
1c39a7d4ab1265740970543e029e1ae8f390e384 | 3,914 | py | Python | Lib/site-packages/pymongo/settings.py | inging44/python3 | fcd8d9d2ee54b46b757ecf34f284b4e60a43097a | [
"bzip2-1.0.6"
] | 32 | 2017-08-29T08:57:16.000Z | 2021-04-21T08:53:04.000Z | Lib/site-packages/pymongo/settings.py | inging44/python3 | fcd8d9d2ee54b46b757ecf34f284b4e60a43097a | [
"bzip2-1.0.6"
] | 108 | 2017-09-04T19:59:28.000Z | 2022-03-31T08:12:07.000Z | Lib/site-packages/pymongo/settings.py | inging44/python3 | fcd8d9d2ee54b46b757ecf34f284b4e60a43097a | [
"bzip2-1.0.6"
] | 14 | 2017-07-06T09:35:30.000Z | 2021-06-03T19:41:48.000Z | # Copyright 2014-2015 MongoDB, 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 writi... | 33.169492 | 73 | 0.686765 |
import threading
from bson.objectid import ObjectId
from pymongo import common, monitor, pool
from pymongo.common import LOCAL_THRESHOLD_MS, SERVER_SELECTION_TIMEOUT
from pymongo.errors import ConfigurationError
from pymongo.topology_description import TOPOLOGY_TYPE
from pymongo.pool import PoolOptions
from pymongo.... | true | true |
1c39a8d92caa68d04b7ab0b59f966fe8d002a086 | 4,049 | py | Python | mmdet/core/bbox/samplers/base_sampler.py | arthur801031/3d-multi-resolution-rcnn | 8e5454a72f8daa174bf3eabfa5964152f04ab287 | [
"Apache-2.0"
] | 16 | 2021-03-02T07:41:01.000Z | 2022-03-14T08:55:45.000Z | mmdet/core/bbox/samplers/base_sampler.py | arthur801031/3d-multi-resolution-rcnn | 8e5454a72f8daa174bf3eabfa5964152f04ab287 | [
"Apache-2.0"
] | 2 | 2022-01-06T20:54:13.000Z | 2022-02-24T03:50:51.000Z | mmdet/core/bbox/samplers/base_sampler.py | arthur801031/3d-multi-resolution-rcnn | 8e5454a72f8daa174bf3eabfa5964152f04ab287 | [
"Apache-2.0"
] | 2 | 2021-05-26T19:23:35.000Z | 2022-01-06T20:30:24.000Z | from abc import ABCMeta, abstractmethod
import torch
from .sampling_result import SamplingResult
class BaseSampler(metaclass=ABCMeta):
def __init__(self,
num,
pos_fraction,
neg_pos_ub=-1,
add_gt_as_proposals=True,
**kwargs):
... | 38.561905 | 136 | 0.602371 | from abc import ABCMeta, abstractmethod
import torch
from .sampling_result import SamplingResult
class BaseSampler(metaclass=ABCMeta):
def __init__(self,
num,
pos_fraction,
neg_pos_ub=-1,
add_gt_as_proposals=True,
**kwargs):
... | true | true |
1c39a9c1963840994365920d42980436d8d9a731 | 1,350 | py | Python | coverage/disposition.py | timofurrer/coveragepy | 72e9761ee79eb2f5b61b21a5427e07fff6acd400 | [
"Apache-2.0"
] | 2,254 | 2015-01-05T01:28:03.000Z | 2022-03-29T10:37:10.000Z | coverage/disposition.py | timofurrer/coveragepy | 72e9761ee79eb2f5b61b21a5427e07fff6acd400 | [
"Apache-2.0"
] | 707 | 2015-02-07T01:32:02.000Z | 2022-03-31T18:00:14.000Z | coverage/disposition.py | sitedata/coveragepy | e4f0f9ee71a1ade66b51ec53d0061f462e3838cb | [
"Apache-2.0"
] | 439 | 2015-01-16T15:06:08.000Z | 2022-03-30T06:19:12.000Z | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Simple value objects for tracking what to do with files."""
class FileDisposition:
"""A simple value type for recording what to do with a file."""
pass... | 33.75 | 79 | 0.696296 |
class FileDisposition:
pass
def disposition_init(cls, original_filename):
disp = cls()
disp.original_filename = original_filename
disp.canonical_filename = original_filename
disp.source_filename = None
disp.trace = False
disp.reason = ""
disp.file_tracer = None
disp.has_dynamic... | true | true |
1c39aa0de256edb03c668ae411a19be0cd31aeec | 237,033 | py | Python | mypy/semanal.py | linw1995/mypy | 2c909125e6fdc7f8855ead6b0091fc2a878d4462 | [
"PSF-2.0"
] | null | null | null | mypy/semanal.py | linw1995/mypy | 2c909125e6fdc7f8855ead6b0091fc2a878d4462 | [
"PSF-2.0"
] | null | null | null | mypy/semanal.py | linw1995/mypy | 2c909125e6fdc7f8855ead6b0091fc2a878d4462 | [
"PSF-2.0"
] | 1 | 2022-01-31T13:24:43.000Z | 2022-01-31T13:24:43.000Z | """The semantic analyzer.
Bind names to definitions and do various other simple consistency
checks. Populate symbol tables. The semantic analyzer also detects
special forms which reuse generic syntax such as NamedTuple and
cast(). Multiple analysis iterations may be needed to analyze forward
references and import c... | 45.269862 | 99 | 0.590956 |
from contextlib import contextmanager
from typing import (
List, Dict, Set, Tuple, cast, TypeVar, Union, Optional, Callable, Iterator, Iterable
)
from typing_extensions import Final
from mypy.nodes import (
MypyFile, TypeInfo, Node, AssignmentStmt, FuncDef, OverloadedFuncDef,
ClassDef, Var, GDEF, FuncIte... | true | true |
1c39ac4dc7d7da37e6d7c8e1160c9f4d77f1d1c3 | 838 | py | Python | nova/scheduler/weights/software_mgmt.py | teresa-ho/stx-nova | 1f82323439da2449edbbaed2fe1c8414a550c86f | [
"Apache-2.0"
] | null | null | null | nova/scheduler/weights/software_mgmt.py | teresa-ho/stx-nova | 1f82323439da2449edbbaed2fe1c8414a550c86f | [
"Apache-2.0"
] | null | null | null | nova/scheduler/weights/software_mgmt.py | teresa-ho/stx-nova | 1f82323439da2449edbbaed2fe1c8414a550c86f | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
"""
SoftwareMgmtWeigher:
- Prefer hosts that are patch current while there remains other hosts that are
not current.
- Prefer hosts that are upgrades current while upgrades are in progress.
"""
from oslo_config import cfg
from no... | 27.933333 | 78 | 0.727924 | from oslo_config import cfg
from nova.scheduler import weights
CONF = cfg.CONF
class SoftwareMgmtWeigher(weights.BaseHostWeigher):
minval = 0
def _weigh_object(self, host_state, weight_properties):
weight = 0.0
if host_state.patch_prefer:
weight += CONF.filter_scheduler.swmgmt_... | true | true |
1c39acce1d04c58907ed9581a977b8853da4ae7c | 3,007 | py | Python | huaweicloud-sdk-as/huaweicloudsdkas/v1/model/show_scaling_group_response.py | wuchen-huawei/huaweicloud-sdk-python-v3 | 3683d703f4320edb2b8516f36f16d485cff08fc2 | [
"Apache-2.0"
] | 1 | 2021-11-03T07:54:50.000Z | 2021-11-03T07:54:50.000Z | huaweicloud-sdk-as/huaweicloudsdkas/v1/model/show_scaling_group_response.py | wuchen-huawei/huaweicloud-sdk-python-v3 | 3683d703f4320edb2b8516f36f16d485cff08fc2 | [
"Apache-2.0"
] | null | null | null | huaweicloud-sdk-as/huaweicloudsdkas/v1/model/show_scaling_group_response.py | wuchen-huawei/huaweicloud-sdk-python-v3 | 3683d703f4320edb2b8516f36f16d485cff08fc2 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
import pprint
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
class ShowScalingGroupResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (... | 27.587156 | 81 | 0.573994 |
import pprint
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
class ShowScalingGroupResponse(SdkResponse):
sensitive_list = []
openapi_types = {
'scaling_group': 'ScalingGroups'
}
attribute_map = {
'scaling_group': 'scaling_group'
}
def __... | true | true |
1c39addef70fc81489f275799f6061afc78af289 | 861 | py | Python | submissions/intro-heuristics/a.py | m-star18/atcoder | 08e475810516602fa088f87daf1eba590b4e07cc | [
"Unlicense"
] | 1 | 2021-05-10T01:16:28.000Z | 2021-05-10T01:16:28.000Z | submissions/intro-heuristics/a.py | m-star18/atcoder | 08e475810516602fa088f87daf1eba590b4e07cc | [
"Unlicense"
] | 3 | 2021-05-11T06:14:15.000Z | 2021-06-19T08:18:36.000Z | submissions/intro-heuristics/a.py | m-star18/atcoder | 08e475810516602fa088f87daf1eba590b4e07cc | [
"Unlicense"
] | null | null | null | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from copy import deepcopy
d = int(readline())
c = list(map(int, readline().split()))
s = [list(map(int, readline().split())... | 25.323529 | 62 | 0.475029 | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from copy import deepcopy
d = int(readline())
c = list(map(int, readline().split()))
s = [list(map(int, readline().split())... | true | true |
1c39adee80341aa646f0761cff680a6923e9d891 | 1,692 | py | Python | tests/pytests/integration/ssh/test_pillar.py | babs/salt | c536ea716d5308880b244e7980f4b659d86fc104 | [
"Apache-2.0"
] | 9,425 | 2015-01-01T05:59:24.000Z | 2022-03-31T20:44:05.000Z | tests/pytests/integration/ssh/test_pillar.py | babs/salt | c536ea716d5308880b244e7980f4b659d86fc104 | [
"Apache-2.0"
] | 33,507 | 2015-01-01T00:19:56.000Z | 2022-03-31T23:48:20.000Z | tests/pytests/integration/ssh/test_pillar.py | babs/salt | c536ea716d5308880b244e7980f4b659d86fc104 | [
"Apache-2.0"
] | 5,810 | 2015-01-01T19:11:45.000Z | 2022-03-31T02:37:20.000Z | import pytest
pytestmark = [
pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"),
]
@pytest.fixture(scope="module")
def pillar_tree(base_env_pillar_tree_root_dir):
top_file = """
base:
'localhost':
- basic
'127.0.0.1':
- basic
"""
basic_pillar_file ... | 24.171429 | 82 | 0.653664 | import pytest
pytestmark = [
pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"),
]
@pytest.fixture(scope="module")
def pillar_tree(base_env_pillar_tree_root_dir):
top_file = """
base:
'localhost':
- basic
'127.0.0.1':
- basic
"""
basic_pillar_file ... | true | true |
1c39ae3478a2d275b999096699a1f31a4a998cb7 | 9,008 | py | Python | pysnmp/proto/api/v1.py | spruning/pysnmp | 023b707f83bb1805dafdcd38ea5b1adfbf83d7e9 | [
"BSD-2-Clause"
] | null | null | null | pysnmp/proto/api/v1.py | spruning/pysnmp | 023b707f83bb1805dafdcd38ea5b1adfbf83d7e9 | [
"BSD-2-Clause"
] | null | null | null | pysnmp/proto/api/v1.py | spruning/pysnmp | 023b707f83bb1805dafdcd38ea5b1adfbf83d7e9 | [
"BSD-2-Clause"
] | null | null | null | #
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2016, Ilya Etingof <ilya@glas.net>
# License: http://pysnmp.sf.net/license.html
#
from pyasn1.type import univ
from pysnmp.proto import rfc1155, rfc1157, error
from pysnmp import nextid
# Shortcuts to SNMP types
Integer = univ.Integer
OctetString = univ.... | 30.12709 | 111 | 0.658748 | from pyasn1.type import univ
from pysnmp.proto import rfc1155, rfc1157, error
from pysnmp import nextid
Integer = univ.Integer
OctetString = univ.OctetString
Null = univ.Null
null = Null('')
ObjectIdentifier = univ.ObjectIdentifier
IpAddress = rfc1155.IpAddress
NetworkAddress = rfc1155.NetworkAddress
Counter = rfc115... | true | true |
1c39aeec153edc1e6962e2b55f5af78f7231ccd0 | 289 | py | Python | C+= language/c+=.py | rzhvn1/Homework-Ogogo | e7e5e48cf144f559a739a1acc7b19373034cda78 | [
"MIT"
] | null | null | null | C+= language/c+=.py | rzhvn1/Homework-Ogogo | e7e5e48cf144f559a739a1acc7b19373034cda78 | [
"MIT"
] | null | null | null | C+= language/c+=.py | rzhvn1/Homework-Ogogo | e7e5e48cf144f559a739a1acc7b19373034cda78 | [
"MIT"
] | null | null | null | num = int(input())
i = 0
while i < num:
count = 0
lst1 = list(map(int,input().split()))
a = lst1[0]
b = lst1[1]
n = lst1[2]
i += 1
while max(a,b) < n + 1:
if a < b:
a += b
else:
b += a
count += 1
print(count)
| 17 | 41 | 0.387543 | num = int(input())
i = 0
while i < num:
count = 0
lst1 = list(map(int,input().split()))
a = lst1[0]
b = lst1[1]
n = lst1[2]
i += 1
while max(a,b) < n + 1:
if a < b:
a += b
else:
b += a
count += 1
print(count)
| true | true |
1c39af69b80fed61354fb436e8fd71bdcf683c24 | 384 | py | Python | change.py | dongchirua/algorithms-101 | 4d25254e00c8003c6bba8d23dda6819771c6dec6 | [
"MIT"
] | null | null | null | change.py | dongchirua/algorithms-101 | 4d25254e00c8003c6bba8d23dda6819771c6dec6 | [
"MIT"
] | null | null | null | change.py | dongchirua/algorithms-101 | 4d25254e00c8003c6bba8d23dda6819771c6dec6 | [
"MIT"
] | null | null | null | # python2
import sys
def get_change(m, denominations=[1, 5, 10]):
result = 0
need = m
while len(denominations):
_d = denominations.pop()
ex = need // _d
if ex:
result += ex
need -= _d * ex
# write your code here
return result
if __name__ == '__main... | 18.285714 | 44 | 0.544271 | import sys
def get_change(m, denominations=[1, 5, 10]):
result = 0
need = m
while len(denominations):
_d = denominations.pop()
ex = need // _d
if ex:
result += ex
need -= _d * ex
return result
if __name__ == '__main__':
n = int(sys.stdin.readli... | true | true |
1c39b01bd0876f6004d3849aa2e645317e05b7c5 | 1,089 | py | Python | trading_strategies/01_线性回归.py | fadeawaylove/stock-trade-system | 133762e6459745fc6c818b43729c1ffff5b9c5ad | [
"Apache-2.0"
] | 3 | 2020-11-10T03:35:05.000Z | 2021-07-04T15:18:44.000Z | trading_strategies/01_线性回归.py | fadeawaylove/stock-trade-system | 133762e6459745fc6c818b43729c1ffff5b9c5ad | [
"Apache-2.0"
] | null | null | null | trading_strategies/01_线性回归.py | fadeawaylove/stock-trade-system | 133762e6459745fc6c818b43729c1ffff5b9c5ad | [
"Apache-2.0"
] | null | null | null | import pandas_datareader.data as web
import pandas as pd
import numpy as np
import datetime
import statsmodels.api as sm
from statsmodels import regression
import matplotlib.pyplot as plt
"""
Statsmodels是Python中一个强大的统计分析包,包含了回归分析、时间序列分析、假设检验等等的功能
"""
plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签
plt.rcPa... | 25.325581 | 114 | 0.728191 | import pandas_datareader.data as web
import pandas as pd
import numpy as np
import datetime
import statsmodels.api as sm
from statsmodels import regression
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = False
df_stockload = web.DataReader("600797.S... | true | true |
1c39b121755a24fef045903cf06f39dea3bdc9bd | 2,499 | py | Python | lib/googlecloudsdk/core/console/style/text.py | kylewuolle/google-cloud-sdk | 75f09ebe779e99fdc3fd13b48621fe12bfaa11aa | [
"Apache-2.0"
] | null | null | null | lib/googlecloudsdk/core/console/style/text.py | kylewuolle/google-cloud-sdk | 75f09ebe779e99fdc3fd13b48621fe12bfaa11aa | [
"Apache-2.0"
] | null | null | null | lib/googlecloudsdk/core/console/style/text.py | kylewuolle/google-cloud-sdk | 75f09ebe779e99fdc3fd13b48621fe12bfaa11aa | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*- #
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | 28.078652 | 74 | 0.70108 |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import enum
class TextAttributes(object):
def __init__(self, format_str=None, color=None, attrs=None):
self._format_str = format_str
self._color = color
self._attrs = attrs or []
@propert... | true | true |
1c39b15409ff79a595f4ad11aa536b39a5c87464 | 18,652 | py | Python | summit/strategies/entmoot.py | dswigh/summit | a1cecdd41df8119005173b46ac45fb22472628d6 | [
"MIT"
] | 60 | 2020-09-10T00:00:03.000Z | 2022-03-08T10:45:02.000Z | summit/strategies/entmoot.py | dswigh/summit | a1cecdd41df8119005173b46ac45fb22472628d6 | [
"MIT"
] | 57 | 2020-09-07T11:06:15.000Z | 2022-02-16T16:30:48.000Z | summit/strategies/entmoot.py | dswigh/summit | a1cecdd41df8119005173b46ac45fb22472628d6 | [
"MIT"
] | 12 | 2020-09-07T12:43:19.000Z | 2022-02-26T09:58:01.000Z | from summit.strategies.base import Strategy
from summit.domain import *
from summit.utils.dataset import DataSet
import string
import numpy as np
import pandas as pd
class ENTMOOT(Strategy):
"""
Single-objective Bayesian optimization, using gradient-boosted trees
instead of Gaussian processes, via ENTMOO... | 38.939457 | 123 | 0.541122 | from summit.strategies.base import Strategy
from summit.domain import *
from summit.utils.dataset import DataSet
import string
import numpy as np
import pandas as pd
class ENTMOOT(Strategy):
def __init__(
self,
domain,
transform=None,
estimator_type=None,
std_estimator_ty... | true | true |
1c39b292b26a8cddc4fc1986b65f20b825c12457 | 3,858 | py | Python | tests/unit/benchmark/scenarios/networking/test_netperf_node.py | kkltcjk/1026 | c9926432e43602a5c00ee6134b2a8dec5f4a7e96 | [
"Apache-2.0"
] | null | null | null | tests/unit/benchmark/scenarios/networking/test_netperf_node.py | kkltcjk/1026 | c9926432e43602a5c00ee6134b2a8dec5f4a7e96 | [
"Apache-2.0"
] | null | null | null | tests/unit/benchmark/scenarios/networking/test_netperf_node.py | kkltcjk/1026 | c9926432e43602a5c00ee6134b2a8dec5f4a7e96 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
##############################################################################
# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompan... | 30.140625 | 78 | 0.581389 |
import mock
import unittest
import os
import json
from yardstick.benchmark.scenarios.networking import netperf_node
@mock.patch('yardstick.benchmark.scenarios.networking.netperf_node.ssh')
class NetperfNodeTestCase(unittest.TestCase):
def setUp(self):
self.ctx = {
'host': {
... | true | true |
1c39b414b0fdb99c1db936586f63ef8042de5f94 | 3,140 | py | Python | Django Server/smart_pot/settings.py | 5Volts/Smart-Pot | 0e1e23c65e40d02ea563c686f9d53ecbd991d710 | [
"MIT"
] | 2 | 2019-03-18T02:53:19.000Z | 2019-05-01T06:47:07.000Z | Django Server/smart_pot/settings.py | 5Volts/Smart-Pot | 0e1e23c65e40d02ea563c686f9d53ecbd991d710 | [
"MIT"
] | null | null | null | Django Server/smart_pot/settings.py | 5Volts/Smart-Pot | 0e1e23c65e40d02ea563c686f9d53ecbd991d710 | [
"MIT"
] | 1 | 2020-01-17T20:20:29.000Z | 2020-01-17T20:20:29.000Z | """
Django settings for smart_pot project.
Generated by 'django-admin startproject' using Django 2.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
... | 25.950413 | 91 | 0.69586 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '#b*$k($wsp$tw0uf(mx%$c@xj-0r8i!ydjo@pd(s)z861cst&h'
DEBUG = True
ALLOWED_HOSTS = ['10.0.0.178','tanrunen.hsd1.ca.comcast.net']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.cont... | true | true |
1c39b4926af1f3f3265ab747f398e37edd4490d0 | 11,065 | py | Python | smartmon.py | chr4/node-exporter-textfile-collector-scripts | 23b0aa0d5b0db999795c752685b8b38d7a61e91a | [
"Apache-2.0"
] | 248 | 2019-08-05T11:31:01.000Z | 2022-03-30T05:59:53.000Z | smartmon.py | chr4/node-exporter-textfile-collector-scripts | 23b0aa0d5b0db999795c752685b8b38d7a61e91a | [
"Apache-2.0"
] | 72 | 2019-08-07T09:16:12.000Z | 2022-01-24T18:54:46.000Z | smartmon.py | chr4/node-exporter-textfile-collector-scripts | 23b0aa0d5b0db999795c752685b8b38d7a61e91a | [
"Apache-2.0"
] | 124 | 2019-08-04T09:45:55.000Z | 2022-03-17T00:40:13.000Z | #!/usr/bin/env python3
import argparse
import collections
import csv
import datetime
import decimal
import re
import shlex
import subprocess
import sys
device_info_re = re.compile(r'^(?P<k>[^:]+?)(?:(?:\sis|):)\s*(?P<v>.*)$')
ata_error_count_re = re.compile(
r'^Error (\d+) \[\d+\] occurred', re.MULTILINE)
self_t... | 28.227041 | 91 | 0.642657 | import argparse
import collections
import csv
import datetime
import decimal
import re
import shlex
import subprocess
import sys
device_info_re = re.compile(r'^(?P<k>[^:]+?)(?:(?:\sis|):)\s*(?P<v>.*)$')
ata_error_count_re = re.compile(
r'^Error (\d+) \[\d+\] occurred', re.MULTILINE)
self_test_re = re.compile(r'^... | true | true |
1c39b62f6f2c649c29dfa51dc505c3af2898db80 | 56,838 | py | Python | src/azure-cli/azure/cli/command_modules/acs/_help.py | chunyu3/azure-cli | 481df7ec3f42067bdf078692cb32e9a27baa6821 | [
"MIT"
] | null | null | null | src/azure-cli/azure/cli/command_modules/acs/_help.py | chunyu3/azure-cli | 481df7ec3f42067bdf078692cb32e9a27baa6821 | [
"MIT"
] | 1 | 2021-02-25T19:22:13.000Z | 2021-02-25T19:22:13.000Z | src/azure-cli/azure/cli/command_modules/acs/_help.py | chunyu3/azure-cli | 481df7ec3f42067bdf078692cb32e9a27baa6821 | [
"MIT"
] | 1 | 2021-08-10T02:08:51.000Z | 2021-08-10T02:08:51.000Z | # coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------... | 51.577132 | 337 | 0.732257 |
from knack.help_files import helps
helps['acs'] = """
type: group
short-summary: Manage Azure Container Services.
long-summary: |
ACS will be retired as a standalone service on January 31, 2020.
If you use the Kubernetes orchestrator, please migrate to AKS by January 31, 2020.
"""
helps['acs browse'] = """... | true | true |
1c39b63189d497454d0be46622f33bef68588c43 | 4,451 | py | Python | nipyapi/nifi/models/processor_status_entity.py | Paul-Verardi/nipyapi | 7a709611d9cf30e4ce8943db4d4dd617f2f7c81c | [
"Apache-2.0"
] | null | null | null | nipyapi/nifi/models/processor_status_entity.py | Paul-Verardi/nipyapi | 7a709611d9cf30e4ce8943db4d4dd617f2f7c81c | [
"Apache-2.0"
] | 1 | 2018-11-13T21:01:33.000Z | 2018-11-13T21:01:33.000Z | nipyapi/nifi/models/processor_status_entity.py | Paul-Verardi/nipyapi | 7a709611d9cf30e4ce8943db4d4dd617f2f7c81c | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
NiFi Rest Api
The Rest Api provides programmatic access to command and control a NiFi instance in real time. Start and stop processors, monitor queues, query provenance data, and more. Each endpoint below includes a description, ... | 29.282895 | 479 | 0.577174 |
from pprint import pformat
from six import iteritems
import re
class ProcessorStatusEntity(object):
swagger_types = {
'processor_status': 'ProcessorStatusDTO',
'can_read': 'bool'
}
attribute_map = {
'processor_status': 'processorStatus',
'can_read': 'canRead'
}
... | true | true |
1c39b8723e21178c7dc9e88cd80aab540aecd383 | 13,923 | py | Python | sinergym/utils/callbacks.py | AlejandroCN7/sinergym | 4e89e478b5c939323e7ddf6a6ecf25a9a13251c6 | [
"MIT"
] | null | null | null | sinergym/utils/callbacks.py | AlejandroCN7/sinergym | 4e89e478b5c939323e7ddf6a6ecf25a9a13251c6 | [
"MIT"
] | null | null | null | sinergym/utils/callbacks.py | AlejandroCN7/sinergym | 4e89e478b5c939323e7ddf6a6ecf25a9a13251c6 | [
"MIT"
] | null | null | null | """Custom Callbacks for stable baselines 3 algorithms."""
import os
from typing import Optional, Union
import gym
import numpy as np
from stable_baselines3.common.callbacks import BaseCallback, EvalCallback
from stable_baselines3.common.env_util import is_wrapped
from stable_baselines3.common.vec_env import VecEnv, s... | 43.373832 | 147 | 0.606119 |
import os
from typing import Optional, Union
import gym
import numpy as np
from stable_baselines3.common.callbacks import BaseCallback, EvalCallback
from stable_baselines3.common.env_util import is_wrapped
from stable_baselines3.common.vec_env import VecEnv, sync_envs_normalization
from sinergym.utils.evaluation imp... | true | true |
1c39b9aca31c7993f8e67a738f983c9eb28d0bf7 | 1,205 | py | Python | models/block.py | uncleguanghui/bitcoin_toolkit | c5898d841201ccd3271adee43f7d116e6333e0d8 | [
"MIT"
] | null | null | null | models/block.py | uncleguanghui/bitcoin_toolkit | c5898d841201ccd3271adee43f7d116e6333e0d8 | [
"MIT"
] | 1 | 2020-10-12T01:52:50.000Z | 2021-06-22T10:29:10.000Z | models/block.py | uncleguanghui/bitcoin_toolkit | c5898d841201ccd3271adee43f7d116e6333e0d8 | [
"MIT"
] | 1 | 2021-03-26T15:18:26.000Z | 2021-03-26T15:18:26.000Z | from datetime import datetime
class Block:
def __init__(self,
block_hash: str,
*,
previous_hash: str = None,
height: int = None,
timestamp: datetime = None,
n_tx: int = None):
assert isinstance(block_hash... | 34.428571 | 94 | 0.575934 | from datetime import datetime
class Block:
def __init__(self,
block_hash: str,
*,
previous_hash: str = None,
height: int = None,
timestamp: datetime = None,
n_tx: int = None):
assert isinstance(block_hash... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.