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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c31542daa5de4d6fed71faf3355aaeb443d153b | 63,918 | py | Python | pandas/core/internals/managers.py | LauraCollard/pandas | b1c3a9031569334cafc4e8d45d35408421f7dea4 | [
"BSD-3-Clause"
] | 2 | 2019-12-02T11:24:30.000Z | 2021-02-28T12:13:54.000Z | pandas/core/internals/managers.py | LauraCollard/pandas | b1c3a9031569334cafc4e8d45d35408421f7dea4 | [
"BSD-3-Clause"
] | 1 | 2019-08-18T16:00:45.000Z | 2019-08-18T16:00:45.000Z | pandas/core/internals/managers.py | LauraCollard/pandas | b1c3a9031569334cafc4e8d45d35408421f7dea4 | [
"BSD-3-Clause"
] | 4 | 2019-10-09T07:52:08.000Z | 2021-07-12T02:37:59.000Z | from collections import defaultdict
from functools import partial
import itertools
import operator
import re
from typing import List, Optional, Sequence, Tuple, Union
import numpy as np
from pandas._libs import Timedelta, Timestamp, internals as libinternals, lib
from pandas.util._validators import validate_bool_kwar... | 31.13395 | 88 | 0.571216 | from collections import defaultdict
from functools import partial
import itertools
import operator
import re
from typing import List, Optional, Sequence, Tuple, Union
import numpy as np
from pandas._libs import Timedelta, Timestamp, internals as libinternals, lib
from pandas.util._validators import validate_bool_kwar... | true | true |
1c3154da6b77f5e2da043f184d552568ae99cd97 | 388 | py | Python | tests/swig/python/family/driver.py | bragaigor/souffle | c39cc5cdb73d23d9af0d48976077c4c0a7943cf2 | [
"UPL-1.0"
] | 570 | 2016-03-15T15:17:18.000Z | 2022-03-27T09:47:45.000Z | tests/swig/python/family/driver.py | bragaigor/souffle | c39cc5cdb73d23d9af0d48976077c4c0a7943cf2 | [
"UPL-1.0"
] | 1,744 | 2016-03-16T19:19:19.000Z | 2022-03-31T21:28:28.000Z | tests/swig/python/family/driver.py | bragaigor/souffle | c39cc5cdb73d23d9af0d48976077c4c0a7943cf2 | [
"UPL-1.0"
] | 183 | 2016-03-12T17:51:20.000Z | 2022-03-24T12:03:47.000Z | """
Souffle - A Datalog Compiler
Copyright (c) 2019, The Souffle Developers. All rights reserved
Licensed under the Universal Permissive License v 1.0 as shown at:
- https://opensource.org/licenses/UPL
- <souffle root>/licenses/SOUFFLE-UPL.txt
"""
import SwigInterface
import sys
p = SwigInterface.newInstance('family')... | 22.823529 | 66 | 0.747423 |
import SwigInterface
import sys
p = SwigInterface.newInstance('family')
p.loadAll(sys.argv[1])
p.run()
p.printAll('.')
p.thisown = 1
del p
| true | true |
1c3155289db24c45371df69cb5782cb0502ebb2a | 2,038 | py | Python | forum2/urls.py | boxed/forum | abb3699d310bf3a404f031a3cb0e4bdbf403da5a | [
"BSD-3-Clause"
] | 2 | 2019-06-28T16:30:44.000Z | 2020-12-28T01:46:52.000Z | forum2/urls.py | boxed/forum | abb3699d310bf3a404f031a3cb0e4bdbf403da5a | [
"BSD-3-Clause"
] | 14 | 2019-02-26T17:25:54.000Z | 2019-04-03T18:11:24.000Z | forum2/urls.py | boxed/forum | abb3699d310bf3a404f031a3cb0e4bdbf403da5a | [
"BSD-3-Clause"
] | 1 | 2019-06-14T14:21:47.000Z | 2019-06-14T14:21:47.000Z | """forum2 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... | 32.870968 | 79 | 0.68842 | from django.urls import path, include
from iommi.admin import Admin
import forum.views as views
import forum2.views
import forum2.views as f2views
import unread.views
import unread.views as unread_views
import issues
class MyAdmin(Admin):
class Meta:
iommi_style = 'bootstrap'
urlpatterns = [
path('... | true | true |
1c31562ad79eb4b6493ac8daf61affd73e900676 | 2,989 | py | Python | ast.py | xXGeistmeisterXx/ast-tools | b55598cb2eb67627036e4e619a9cb26b9f50093f | [
"MIT"
] | null | null | null | ast.py | xXGeistmeisterXx/ast-tools | b55598cb2eb67627036e4e619a9cb26b9f50093f | [
"MIT"
] | null | null | null | ast.py | xXGeistmeisterXx/ast-tools | b55598cb2eb67627036e4e619a9cb26b9f50093f | [
"MIT"
] | null | null | null | import json
import re
default = [0.0, 0.0, 0.0]
rounding = 5
def setValue(dict, obj, pose, pose_name):
if(pose in dict):
obj[pose_name] = [float(dict[pose][0][:len(dict[pose][0])-1]), float(dict[pose][1][:len(dict[pose][1])-1]), float(dict[pose][2][:len(dict[pose][2])-1])]
else:
obj[pose_name] = defau... | 37.835443 | 205 | 0.611576 | import json
import re
default = [0.0, 0.0, 0.0]
rounding = 5
def setValue(dict, obj, pose, pose_name):
if(pose in dict):
obj[pose_name] = [float(dict[pose][0][:len(dict[pose][0])-1]), float(dict[pose][1][:len(dict[pose][1])-1]), float(dict[pose][2][:len(dict[pose][2])-1])]
else:
obj[pose_name] = defau... | true | true |
1c31564e9f41bef1f7beef9e9f4cb58fe1f9d57c | 23,221 | py | Python | ploy_ezjail/__init__.py | ployground/ploy_ezjail | d55eb49a9a9163117c3b44b5308ca3424f8e2def | [
"BSD-3-Clause"
] | 2 | 2016-04-22T09:12:00.000Z | 2021-07-27T08:58:06.000Z | ploy_ezjail/__init__.py | ployground/ploy_ezjail | d55eb49a9a9163117c3b44b5308ca3424f8e2def | [
"BSD-3-Clause"
] | 7 | 2015-01-30T23:43:01.000Z | 2017-03-31T19:53:28.000Z | ploy_ezjail/__init__.py | ployground/ploy_ezjail | d55eb49a9a9163117c3b44b5308ca3424f8e2def | [
"BSD-3-Clause"
] | 4 | 2015-10-16T10:58:50.000Z | 2018-02-22T18:05:11.000Z | from fnmatch import fnmatch
from lazy import lazy
from ploy.common import BaseMaster, Executor, StartupScriptMixin
from ploy.common import parse_ssh_keygen
from ploy.config import BaseMassager, value_asbool
from ploy.plain import Instance as PlainInstance
from ploy.proxy import ProxyInstance
import logging
import re
im... | 36.282813 | 151 | 0.526248 | from fnmatch import fnmatch
from lazy import lazy
from ploy.common import BaseMaster, Executor, StartupScriptMixin
from ploy.common import parse_ssh_keygen
from ploy.config import BaseMassager, value_asbool
from ploy.plain import Instance as PlainInstance
from ploy.proxy import ProxyInstance
import logging
import re
im... | true | true |
1c3156b5704c9bf5279b31e089a46032268f65f0 | 703 | py | Python | label_import/label.py | jscheytt/endo-loc | e425716e434087157ada3e35c309281dda3eca62 | [
"Apache-2.0"
] | null | null | null | label_import/label.py | jscheytt/endo-loc | e425716e434087157ada3e35c309281dda3eca62 | [
"Apache-2.0"
] | null | null | null | label_import/label.py | jscheytt/endo-loc | e425716e434087157ada3e35c309281dda3eca62 | [
"Apache-2.0"
] | null | null | null | from enum import Enum
class ILabelValue(Enum):
"""
Possible values for an ILabel.
"""
IN, OUT, MOVING_IN, MOVING_OUT, IN_BETWEEN, EXIT = range(6)
ADS = -1
class ILabel:
"""
Label denoting location of the endoscope.
"""
def __init__(self, start, end, value):
"""
B... | 21.96875 | 73 | 0.601707 | from enum import Enum
class ILabelValue(Enum):
IN, OUT, MOVING_IN, MOVING_OUT, IN_BETWEEN, EXIT = range(6)
ADS = -1
class ILabel:
def __init__(self, start, end, value):
self.start = start
self.end = end
self.value = value
def __len__(self):
return len(self.start) + ... | true | true |
1c3157ffaa98687e0d1d3da9cbb7888ecc676368 | 2,145 | py | Python | JarekG/2_python_controlflow/file_read_d.py | Khayn/2021-12-elearning-pythonana | a54e407adc8fb8c3a5fd2522735ae09cdef6540a | [
"MIT"
] | null | null | null | JarekG/2_python_controlflow/file_read_d.py | Khayn/2021-12-elearning-pythonana | a54e407adc8fb8c3a5fd2522735ae09cdef6540a | [
"MIT"
] | null | null | null | JarekG/2_python_controlflow/file_read_d.py | Khayn/2021-12-elearning-pythonana | a54e407adc8fb8c3a5fd2522735ae09cdef6540a | [
"MIT"
] | null | null | null | """
* Assignment: File Read CleanFile
* Required: no
* Complexity: medium
* Lines of code: 10 lines
* Time: 8 min
English:
1. Read `FILE` and for each line:
a. Remove leading and trailing whitespaces
b. Skip line if it is empty
c. Split line by whitespace
d. Separate IP address and ... | 28.6 | 91 | 0.61352 |
FILE = '_temporary.txt'
DATA = """127.0.0.1 localhost
10.13.37.1 nasa.gov esa.int roscosmos.ru
255.255.255.255 broadcasthost
::1 localhost
"""
with open(FILE, mode='w') as file:
file.write(DATA)
result = {}
with open(FILE, mode='r') as f:
lines = f.readlines()
for line in lines:
... | true | true |
1c3158a78f65cde7e262ec2d3dac6a9d0a56e74d | 35,011 | py | Python | rr_graph/channel.py | mithro/symbiflow-rr-graph | 33c7d952b72d03bd40265df13900526846abc7d5 | [
"0BSD"
] | 2 | 2020-11-25T03:00:33.000Z | 2021-12-21T07:29:44.000Z | rr_graph/channel.py | mithro/symbiflow-rr-graph | 33c7d952b72d03bd40265df13900526846abc7d5 | [
"0BSD"
] | 10 | 2020-07-24T17:09:35.000Z | 2022-02-07T17:55:49.000Z | rr_graph/channel.py | mithro/symbiflow-rr-graph | 33c7d952b72d03bd40265df13900526846abc7d5 | [
"0BSD"
] | 4 | 2020-11-06T09:07:14.000Z | 2021-09-17T16:38:19.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2021 The SymbiFlow Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
"""
This file for packing tracks into c... | 29.273411 | 92 | 0.464797 |
import pprint
import enum
import io
from collections import namedtuple
import lxml.etree as ET
from . import Position
from . import Size
from . import node_pos, single_element
from .utils.asserts import assert_eq
from .utils.asserts import assert_len_eq
from .utils.asserts import assert_type
from .utils.asserts im... | true | true |
1c3158f023b98bdbd790861d7edf522138fed93f | 4,974 | py | Python | contrib/node/tests/python/pants_test/contrib/node/tasks/test_node_task.py | anthonyjpratti/pants | d98e53af6ddd877861231bce8343f8204da0a9d1 | [
"Apache-2.0"
] | null | null | null | contrib/node/tests/python/pants_test/contrib/node/tasks/test_node_task.py | anthonyjpratti/pants | d98e53af6ddd877861231bce8343f8204da0a9d1 | [
"Apache-2.0"
] | null | null | null | contrib/node/tests/python/pants_test/contrib/node/tasks/test_node_task.py | anthonyjpratti/pants | d98e53af6ddd877861231bce8343f8204da0a9d1 | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import json
import os
import string
from textwrap import dedent
from pants.build_graph.target import Target
from pants.testutil.task_test_base import TaskTestBase
from pants.util.contextu... | 33.608108 | 97 | 0.664254 |
import json
import os
import string
from textwrap import dedent
from pants.build_graph.target import Target
from pants.testutil.task_test_base import TaskTestBase
from pants.util.contextutil import pushd, temporary_dir
from pants.contrib.node.targets.node_module import NodeModule
from pants.contrib.node.targets.node... | true | true |
1c31596f5d270636d8249982d87c2af04c309ec7 | 146 | py | Python | answers/x_3_3.py | ofl/kuku2 | 7247fb1862d917d23258ebe7a93dca5939433225 | [
"MIT"
] | null | null | null | answers/x_3_3.py | ofl/kuku2 | 7247fb1862d917d23258ebe7a93dca5939433225 | [
"MIT"
] | 1 | 2021-11-13T08:03:04.000Z | 2021-11-13T08:03:04.000Z | answers/x_3_3.py | ofl/kuku2 | 7247fb1862d917d23258ebe7a93dca5939433225 | [
"MIT"
] | null | null | null | # x_3_3
#
# statistics.meanで計算した平均の値の小数低下を切り捨ててください
import statistics
import math
data = [7, 4, 3, 9]
print(math.floor(statistics.mean(data)))
| 13.272727 | 41 | 0.746575 |
import statistics
import math
data = [7, 4, 3, 9]
print(math.floor(statistics.mean(data)))
| true | true |
1c315a78f08f3eb22cdbe8649826051b76d55dc4 | 886 | py | Python | mysite/polls/models.py | sssunda/django-test | c262dcbf4599dd222ceeb0256e1005a1802ea997 | [
"MIT"
] | 1 | 2019-06-06T07:56:38.000Z | 2019-06-06T07:56:38.000Z | mysite/polls/models.py | sssunda/django-test | c262dcbf4599dd222ceeb0256e1005a1802ea997 | [
"MIT"
] | null | null | null | mysite/polls/models.py | sssunda/django-test | c262dcbf4599dd222ceeb0256e1005a1802ea997 | [
"MIT"
] | null | null | null | import datetime
from django.db import models
from django.utils import timezone
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def was_... | 28.580645 | 70 | 0.716704 | import datetime
from django.db import models
from django.utils import timezone
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def was_published_recently(self):
... | true | true |
1c315b71a2c81781e8dda407026d012b61f1f9c8 | 4,020 | py | Python | python/tools/metrics.py | bearsroom/mxnet-augmented | af4843b249e312014d54ce38545fcb4fa546d7db | [
"Apache-2.0"
] | 1 | 2019-01-16T03:57:53.000Z | 2019-01-16T03:57:53.000Z | python/tools/metrics.py | bearsroom/mxnet-augmented | af4843b249e312014d54ce38545fcb4fa546d7db | [
"Apache-2.0"
] | null | null | null | python/tools/metrics.py | bearsroom/mxnet-augmented | af4843b249e312014d54ce38545fcb4fa546d7db | [
"Apache-2.0"
] | null | null | null |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
class Metrics:
def __init__(self, num_classes):
self.num_classes = num_classes
self.reset()
def reset(self):
self.tp = np.zeros((self.num_classes, ), dtype=np.float32)
self.fp = np.zeros... | 37.570093 | 105 | 0.575871 |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
class Metrics:
def __init__(self, num_classes):
self.num_classes = num_classes
self.reset()
def reset(self):
self.tp = np.zeros((self.num_classes, ), dtype=np.float32)
self.fp = np.zeros... | true | true |
1c315d2b105e29664405e2585fb0f7c0c8048c8b | 894 | py | Python | python_code/vnev/Lib/site-packages/jdcloud_sdk/services/mps/models/ThumbnailTaskSource.py | Ureimu/weather-robot | 7634195af388538a566ccea9f8a8534c5fb0f4b6 | [
"MIT"
] | null | null | null | python_code/vnev/Lib/site-packages/jdcloud_sdk/services/mps/models/ThumbnailTaskSource.py | Ureimu/weather-robot | 7634195af388538a566ccea9f8a8534c5fb0f4b6 | [
"MIT"
] | null | null | null | python_code/vnev/Lib/site-packages/jdcloud_sdk/services/mps/models/ThumbnailTaskSource.py | Ureimu/weather-robot | 7634195af388538a566ccea9f8a8534c5fb0f4b6 | [
"MIT"
] | null | null | null | # coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... | 29.8 | 75 | 0.705817 |
class ThumbnailTaskSource(object):
def __init__(self, bucket, key, ):
self.bucket = bucket
self.key = key
| true | true |
1c315df0d25a6b51d1daf2448ba6c2e59d1bf433 | 18,957 | py | Python | src/schnetpack/representation/schnet.py | CLEANit/schnetpack | 4760ff452e10e5f8b75d19c3f2db595145bcae0b | [
"MIT"
] | null | null | null | src/schnetpack/representation/schnet.py | CLEANit/schnetpack | 4760ff452e10e5f8b75d19c3f2db595145bcae0b | [
"MIT"
] | null | null | null | src/schnetpack/representation/schnet.py | CLEANit/schnetpack | 4760ff452e10e5f8b75d19c3f2db595145bcae0b | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
from schnetpack.nn.base import Dense, ScaleShift
from schnetpack import Properties
from schnetpack.nn.cfconv import CFConv, VoxelCFConv
from schnetpack.nn.cutoff import CosineCutoff
from schnetpack.nn.acsf import GaussianSmearing
from schnetpack.nn.neighbors import AtomDistances
from... | 40.767742 | 90 | 0.633223 | import torch
import torch.nn as nn
from schnetpack.nn.base import Dense, ScaleShift
from schnetpack import Properties
from schnetpack.nn.cfconv import CFConv, VoxelCFConv
from schnetpack.nn.cutoff import CosineCutoff
from schnetpack.nn.acsf import GaussianSmearing
from schnetpack.nn.neighbors import AtomDistances
from... | true | true |
1c315eaced8aca10753a735564baefa1368a0036 | 871 | py | Python | adafruit_circuitpython_libs/adafruit-circuitpython-bundle-py-20210214/examples/ssd1675_simpletest.py | jacoblb64/pico_rgb_keypad_hid | 3251ca6a98ef86d9f98c54f639c4d61810601a0b | [
"MIT"
] | 47 | 2021-02-15T23:02:36.000Z | 2022-03-04T21:30:03.000Z | adafruit_circuitpython_libs/adafruit-circuitpython-bundle-py-20210214/examples/ssd1675_simpletest.py | jacoblb64/pico_rgb_keypad_hid | 3251ca6a98ef86d9f98c54f639c4d61810601a0b | [
"MIT"
] | 7 | 2021-02-19T20:00:08.000Z | 2022-01-14T10:51:12.000Z | adafruit_circuitpython_libs/adafruit-circuitpython-bundle-py-20210214/examples/ssd1675_simpletest.py | jacoblb64/pico_rgb_keypad_hid | 3251ca6a98ef86d9f98c54f639c4d61810601a0b | [
"MIT"
] | 14 | 2021-02-20T17:40:56.000Z | 2022-01-01T19:53:38.000Z | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""Simple test script for 2.13" 250x122 black and white featherwing.
Supported products:
* Adafruit 2.13" Black and White FeatherWing
* https://www.adafruit.com/product/4195
"""
import time
import board
import displ... | 20.255814 | 83 | 0.756602 |
import time
import board
import displayio
import adafruit_ssd1675
displayio.release_displays()
epd_cs = board.D9
epd_dc = board.D10
display_bus = displayio.FourWire(
board.SPI(), command=epd_dc, chip_select=epd_cs, baudrate=1000000
)
time.sleep(1)
display = adafruit_ssd1675.SSD1675(display_bus, width=250, hei... | true | true |
1c315ef7cf27f9128f96932f9a59d1ce4eced390 | 409 | py | Python | config.py | sasili-adetunji/featureRequest | eb4a46f57566462cdf9a1ab513a062498d34ecd8 | [
"MIT"
] | null | null | null | config.py | sasili-adetunji/featureRequest | eb4a46f57566462cdf9a1ab513a062498d34ecd8 | [
"MIT"
] | null | null | null | config.py | sasili-adetunji/featureRequest | eb4a46f57566462cdf9a1ab513a062498d34ecd8 | [
"MIT"
] | null | null | null | import os
from dotenv import load_dotenv
basedir = os.path.abspath(os.path.dirname(__file__))
load_dotenv(os.path.join(basedir, '.env'))
class Config(object):
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI') or \
'... | 31.461538 | 76 | 0.728606 | import os
from dotenv import load_dotenv
basedir = os.path.abspath(os.path.dirname(__file__))
load_dotenv(os.path.join(basedir, '.env'))
class Config(object):
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI') or \
'... | true | true |
1c315ff863a29b576ddb63f0c83e87ea550ff7ea | 78,587 | py | Python | keystone/identity/backends/ldap/common.py | ISCAS-VDI/keystone | 11af181c06d78026c89a873f62931558e80f3192 | [
"Apache-2.0"
] | null | null | null | keystone/identity/backends/ldap/common.py | ISCAS-VDI/keystone | 11af181c06d78026c89a873f62931558e80f3192 | [
"Apache-2.0"
] | null | null | null | keystone/identity/backends/ldap/common.py | ISCAS-VDI/keystone | 11af181c06d78026c89a873f62931558e80f3192 | [
"Apache-2.0"
] | null | null | null | # Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 40.136364 | 79 | 0.590568 |
import abc
import codecs
import functools
import os.path
import re
import sys
import weakref
import ldap.controls
import ldap.filter
import ldappool
from oslo_log import log
from oslo_utils import reflection
import six
from six.moves import map, zip
from keystone.common import driver_hints
from keystone import excep... | true | true |
1c3161819e86146482e457f2ccd896d9d5d1d5de | 37,217 | py | Python | get_map.py | yoqi/yolov4-pytorch-jinshuquexian | cea88e5cf51bfa15590a6bb0a68c63701985d7bf | [
"MIT"
] | null | null | null | get_map.py | yoqi/yolov4-pytorch-jinshuquexian | cea88e5cf51bfa15590a6bb0a68c63701985d7bf | [
"MIT"
] | null | null | null | get_map.py | yoqi/yolov4-pytorch-jinshuquexian | cea88e5cf51bfa15590a6bb0a68c63701985d7bf | [
"MIT"
] | null | null | null | import argparse
import glob
import json
import math
import operator
import os
import shutil
import sys
import numpy as np
#----------------------------------------------------#
# 用于计算 mAP
# 代码克隆自 https://github.com/Cartucho/mAP
#----------------------------------------------------#
MINOVERLAP = 0.5 # default val... | 38.929916 | 138 | 0.572427 | import argparse
import glob
import json
import math
import operator
import os
import shutil
import sys
import numpy as np
MINOVERLAP = 0.5
parser = argparse.ArgumentParser()
parser.add_argument('-na', '--no-animation', help="no animation is shown.", action="store_true")
parser.add_argument('-np', '--no-plot', help="... | true | true |
1c3162f3c2a0e8aa04611bdbe0ec3520a34c70ce | 593 | py | Python | capstone/capapi/tests/test_doc_views.py | jcushman/capstone | ef3ced77f69aabe14c89ab67003a6e88736bf777 | [
"MIT"
] | null | null | null | capstone/capapi/tests/test_doc_views.py | jcushman/capstone | ef3ced77f69aabe14c89ab67003a6e88736bf777 | [
"MIT"
] | 4 | 2021-09-02T20:54:31.000Z | 2022-02-27T14:04:06.000Z | capstone/capapi/tests/test_doc_views.py | jcushman/capstone | ef3ced77f69aabe14c89ab67003a6e88736bf777 | [
"MIT"
] | 1 | 2018-08-31T15:11:28.000Z | 2018-08-31T15:11:28.000Z | import re
import pytest
from capapi.tests.helpers import check_response
from django.conf import settings
@pytest.mark.django_db
def test_get_docs_urls(client, jurisdiction, case, reporter):
"""
Test that every url in docs.html is functional
"""
settings.API_DOCS_CASE_ID = case.id
response = clien... | 23.72 | 61 | 0.664418 | import re
import pytest
from capapi.tests.helpers import check_response
from django.conf import settings
@pytest.mark.django_db
def test_get_docs_urls(client, jurisdiction, case, reporter):
settings.API_DOCS_CASE_ID = case.id
response = client.get('/')
html = response.content.decode()
tmp_html = re.s... | true | true |
1c316427aff8b8d02a683b7d44980c9cd0d4f02a | 1,625 | py | Python | lib/utils/blob.py | wxshan/py-R-FCN | 347472ecbecb0bad38ff8deb612a5e9ed123c063 | [
"MIT"
] | 8,776 | 2015-10-05T04:08:47.000Z | 2022-03-30T17:12:08.000Z | lib/utils/blob.py | arasharchor/py-faster-rcnn_rotated | de5f4c7abbeca5e55930f863ccb78da4fe130e5a | [
"MIT"
] | 900 | 2015-10-08T04:10:13.000Z | 2022-03-10T05:13:56.000Z | lib/utils/blob.py | arasharchor/py-faster-rcnn_rotated | de5f4c7abbeca5e55930f863ccb78da4fe130e5a | [
"MIT"
] | 4,685 | 2015-10-05T04:08:50.000Z | 2022-03-31T04:44:31.000Z | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Blob helper functions."""
import numpy as np
import cv2
def im_lis... | 35.326087 | 75 | 0.607385 |
import numpy as np
import cv2
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 xrange(num_images):
im = ims[i]
blob[i, ... | true | true |
1c3164479f8062feb8f1fd30f8df5e3ef93c9794 | 337 | py | Python | src/dialogs/data_models/room_reservation.py | Joffreybvn/resa-chatbot | 3ca845d4264f29f49b5b0bcee39a0ece7f480f66 | [
"MIT"
] | null | null | null | src/dialogs/data_models/room_reservation.py | Joffreybvn/resa-chatbot | 3ca845d4264f29f49b5b0bcee39a0ece7f480f66 | [
"MIT"
] | null | null | null | src/dialogs/data_models/room_reservation.py | Joffreybvn/resa-chatbot | 3ca845d4264f29f49b5b0bcee39a0ece7f480f66 | [
"MIT"
] | 1 | 2021-02-03T18:43:38.000Z | 2021-02-03T18:43:38.000Z |
class RoomReservation:
"""Hotel's room reservation state."""
def __init__(self, people: int = None, duration: int = None, breakfast: bool = None):
self.people: int = people # Number of people
self.duration: int = duration # Number of nights
self.breakfast: bool = breakfast # If the... | 33.7 | 89 | 0.655786 |
class RoomReservation:
def __init__(self, people: int = None, duration: int = None, breakfast: bool = None):
self.people: int = people self.duration: int = duration self.breakfast: bool = breakfast | true | true |
1c3164ae3d284c6014e8e16d40e6d0a532019d1a | 10,281 | py | Python | src/crate/client/sqlalchemy/dialect.py | mxm/crate-python | de13bf4a04e7c45864ebfdc144dffe1ddb53b88f | [
"Apache-2.0"
] | null | null | null | src/crate/client/sqlalchemy/dialect.py | mxm/crate-python | de13bf4a04e7c45864ebfdc144dffe1ddb53b88f | [
"Apache-2.0"
] | null | null | null | src/crate/client/sqlalchemy/dialect.py | mxm/crate-python | de13bf4a04e7c45864ebfdc144dffe1ddb53b88f | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... | 36.587189 | 79 | 0.636028 |
from __future__ import absolute_import
import logging
from datetime import datetime, date
from sqlalchemy import types as sqltypes
from sqlalchemy.engine import default, reflection
from .compiler import (
CrateCompiler,
CrateTypeCompiler,
CrateDDLCompiler
)
from crate.client.exceptions import TimezoneUna... | true | true |
1c3165112802098c2143e6851e1196e5ee5308b9 | 476 | py | Python | epi_judge_python/bst_node.py | shobhitmishra/CodingProblems | 0fc8c5037eef95b3ec9826b3a6e48885fc86659e | [
"MIT"
] | null | null | null | epi_judge_python/bst_node.py | shobhitmishra/CodingProblems | 0fc8c5037eef95b3ec9826b3a6e48885fc86659e | [
"MIT"
] | null | null | null | epi_judge_python/bst_node.py | shobhitmishra/CodingProblems | 0fc8c5037eef95b3ec9826b3a6e48885fc86659e | [
"MIT"
] | null | null | null | from test_framework.binary_tree_utils import (binary_tree_to_string,
equal_binary_trees)
class BstNode:
def __init__(self, data=None, left=None, right=None):
self.data, self.left, self.right = data, left, right
def __eq__(self, other):
return equa... | 28 | 68 | 0.634454 | from test_framework.binary_tree_utils import (binary_tree_to_string,
equal_binary_trees)
class BstNode:
def __init__(self, data=None, left=None, right=None):
self.data, self.left, self.right = data, left, right
def __eq__(self, other):
return equa... | true | true |
1c3165daab4a6b606aa7653f0eb1609c0722ff52 | 9,248 | py | Python | loggers_control/scripts/envs/se.py | linZHank/two_loggers | 34b02e443681ddabe796d73863b24b5499168895 | [
"MIT"
] | 4 | 2019-06-09T08:25:25.000Z | 2020-09-19T01:04:49.000Z | loggers_control/scripts/envs/se.py | linZHank/two_loggers | 34b02e443681ddabe796d73863b24b5499168895 | [
"MIT"
] | 7 | 2019-02-01T21:52:27.000Z | 2020-11-02T03:46:21.000Z | loggers_control/scripts/envs/se.py | linZHank/two_loggers | 34b02e443681ddabe796d73863b24b5499168895 | [
"MIT"
] | 5 | 2019-05-06T15:21:25.000Z | 2021-09-22T02:48:33.000Z | #!/usr/bin/env python
"""
Solo escape environment with discrete action space
"""
from __future__ import absolute_import, division, print_function
import sys
import os
import numpy as np
from numpy import pi
from numpy import random
import rospy
import tf
from std_srvs.srv import Empty
from gazebo_msgs.srv import Set... | 35.030303 | 134 | 0.585424 |
from __future__ import absolute_import, division, print_function
import sys
import os
import numpy as np
from numpy import pi
from numpy import random
import rospy
import tf
from std_srvs.srv import Empty
from gazebo_msgs.srv import SetModelState, GetModelState
from gazebo_msgs.msg import ModelState, ModelStates
fro... | true | true |
1c31661c3a0ef59d87bdec5f52507688f7fa757f | 650 | py | Python | non_demo/tmp36_sensor/reporting.py | alexellis/datacenter-sensor | d51f8fe3debb7e11d0786c26f13c6a2fed7f659d | [
"MIT"
] | 22 | 2016-06-19T03:13:31.000Z | 2020-05-07T18:54:09.000Z | non_demo/tmp36_sensor/reporting.py | alexellis/datacenter-sensor | d51f8fe3debb7e11d0786c26f13c6a2fed7f659d | [
"MIT"
] | null | null | null | non_demo/tmp36_sensor/reporting.py | alexellis/datacenter-sensor | d51f8fe3debb7e11d0786c26f13c6a2fed7f659d | [
"MIT"
] | 9 | 2016-09-12T18:40:38.000Z | 2021-01-15T15:40:43.000Z | import redis
import socket
class Reporter:
def __init__(self, host, port):
self.host = host
self.port = port
self.name = socket.getfqdn()
def announce(self):
self.client = redis.StrictRedis(host=self.host, port=self.port, db=0)
self.client.hset("members", self.name, "1")
... | 26 | 77 | 0.62 | import redis
import socket
class Reporter:
def __init__(self, host, port):
self.host = host
self.port = port
self.name = socket.getfqdn()
def announce(self):
self.client = redis.StrictRedis(host=self.host, port=self.port, db=0)
self.client.hset("members", self.name, "1")
... | true | true |
1c31676b1fcdbcac0200c101e46d8f7dcaa9f51d | 290 | py | Python | Trinkey_QT2040_TRNG_Gadget/python/trng_read_json.py | gamblor21/Adafruit_Learning_System_Guides | f5dab4a758bc82d0bfc3c299683fe89dc093912a | [
"MIT"
] | 665 | 2017-09-27T21:20:14.000Z | 2022-03-31T09:09:25.000Z | Trinkey_QT2040_TRNG_Gadget/python/trng_read_json.py | gamblor21/Adafruit_Learning_System_Guides | f5dab4a758bc82d0bfc3c299683fe89dc093912a | [
"MIT"
] | 641 | 2017-10-03T19:46:37.000Z | 2022-03-30T18:28:46.000Z | Trinkey_QT2040_TRNG_Gadget/python/trng_read_json.py | gamblor21/Adafruit_Learning_System_Guides | f5dab4a758bc82d0bfc3c299683fe89dc093912a | [
"MIT"
] | 734 | 2017-10-02T22:47:38.000Z | 2022-03-30T14:03:51.000Z | import json
import serial
# open serial port
ss = serial.Serial("/dev/ttyACM0")
# read string
_ = ss.readline() # first read may be incomplete, just toss it
raw_string = ss.readline().strip().decode()
# load JSON
json_data = json.loads(raw_string)
# print data
print(json_data['trng'])
| 18.125 | 62 | 0.72069 | import json
import serial
ss = serial.Serial("/dev/ttyACM0")
_ = ss.readline() raw_string = ss.readline().strip().decode()
json_data = json.loads(raw_string)
print(json_data['trng'])
| true | true |
1c3168173a7050e47e1e563d085db1e50c81e804 | 2,127 | py | Python | TAHMO/__init__.py | lionfish0/TAHMO | 9e20bef1817b11d5dc476775369294de5daedb05 | [
"MIT"
] | null | null | null | TAHMO/__init__.py | lionfish0/TAHMO | 9e20bef1817b11d5dc476775369294de5daedb05 | [
"MIT"
] | null | null | null | TAHMO/__init__.py | lionfish0/TAHMO | 9e20bef1817b11d5dc476775369294de5daedb05 | [
"MIT"
] | null | null | null | import requests
import json
class TAHMO:
def __init__(self,baseurl='https://tahmoapi.mybluemix.net/v1'):
"""
Minimalist wrapper for accessing the TAHMO API (v1).
arguments:
baseurl = url of the API, default: https://tahmoapi.mybluemix.net/v1
"""
self.bas... | 34.306452 | 102 | 0.574518 | import requests
import json
class TAHMO:
def __init__(self,baseurl='https://tahmoapi.mybluemix.net/v1'):
self.baseurl = baseurl
def setCredentials(self,api_id,api_secret):
self.api_id = api_id
self.api_secret = api_secret
def setCredentialsFromJsonFile(self,api_credentials_file):
... | true | true |
1c31689e12fa8efaa5472244e62dabcd6668b8c3 | 18,379 | py | Python | dadguide/monster_index.py | chasehult/padbot-cogs | 627b2e7be6103ca6fbe0cb8b6e0500ea8fc21bbb | [
"MIT"
] | null | null | null | dadguide/monster_index.py | chasehult/padbot-cogs | 627b2e7be6103ca6fbe0cb8b6e0500ea8fc21bbb | [
"MIT"
] | null | null | null | dadguide/monster_index.py | chasehult/padbot-cogs | 627b2e7be6103ca6fbe0cb8b6e0500ea8fc21bbb | [
"MIT"
] | null | null | null | import asyncio
import csv
import inspect
import io
import logging
import re
from collections import defaultdict
import aiohttp
from redbot.core.utils import AsyncIter
from tsutils import aobject
from .token_mappings import *
SHEETS_PATTERN = 'https://docs.google.com/spreadsheets/d/1EoZJ3w5xsXZ67kmarLE4vfrZSIIIAfj04H... | 41.20852 | 120 | 0.580717 | import asyncio
import csv
import inspect
import io
import logging
import re
from collections import defaultdict
import aiohttp
from redbot.core.utils import AsyncIter
from tsutils import aobject
from .token_mappings import *
SHEETS_PATTERN = 'https://docs.google.com/spreadsheets/d/1EoZJ3w5xsXZ67kmarLE4vfrZSIIIAfj04H... | true | true |
1c31689e64399dba81eb63ef2f0d091a4e35c238 | 3,249 | py | Python | tools/setoverscan.py | danielforgacs/Maya-tools | 66d030d3a3ba7e8caa5145a6f141f8eca15b7729 | [
"MIT"
] | 4 | 2018-06-06T22:42:34.000Z | 2021-01-16T06:28:54.000Z | tools/setoverscan.py | danielforgacs/Maya-tools | 66d030d3a3ba7e8caa5145a6f141f8eca15b7729 | [
"MIT"
] | null | null | null | tools/setoverscan.py | danielforgacs/Maya-tools | 66d030d3a3ba7e8caa5145a6f141f8eca15b7729 | [
"MIT"
] | 1 | 2020-02-11T07:08:33.000Z | 2020-02-11T07:08:33.000Z | """
calculate and set camera values
for overscan in one camera setup
overscan is not uniform. It matches
image proportions - rounded
if the selected camera has post scale
you get an error - no duplaicate overscan
default overscan:
50 / 50 pixels :: top / bottom
Select camera, call: main(); main(pixels=30)
for t... | 26.631148 | 114 | 0.627886 |
from fractions import Fraction
try:
import pymel.core
except:
pm = None
def get_osc_values(resx, resy, pixels):
resy_osc = resy + (pixels * 2)
osc_scale = resy_osc / resy
postscale = 1 / osc_scale
resx_osc = resx * osc_scale
return {
'x_osc': int(round(resx_osc)),... | true | true |
1c31699971d7e0eabc1fd2fcf67999df6c0d79fc | 386 | py | Python | nepali/datetime/__init__.py | aj3sh/nepali | bae66301eca7bfb51c53d54bfda56d6e425ef0a6 | [
"MIT"
] | 2 | 2019-05-25T15:17:56.000Z | 2020-09-24T07:21:00.000Z | nepali/datetime/__init__.py | aj3sh/nepali | bae66301eca7bfb51c53d54bfda56d6e425ef0a6 | [
"MIT"
] | null | null | null | nepali/datetime/__init__.py | aj3sh/nepali | bae66301eca7bfb51c53d54bfda56d6e425ef0a6 | [
"MIT"
] | 2 | 2020-04-03T05:50:46.000Z | 2020-10-15T16:18:37.000Z | from ._datetime import nepalidate, nepalitime, nepalidatetime, NepaliDate, NepaliDateTime, NepaliTime
from ._formarter import NepaliDateTimeFormater
from ._humanize import HumanizeDateTime, nepalihumanize
__all__ = [
'nepalidate',
'nepalitime',
'nepalidatetime',
'NepaliDate',
'NepaliTime',
'NepaliDateTime',
'... | 22.705882 | 101 | 0.790155 | from ._datetime import nepalidate, nepalitime, nepalidatetime, NepaliDate, NepaliDateTime, NepaliTime
from ._formarter import NepaliDateTimeFormater
from ._humanize import HumanizeDateTime, nepalihumanize
__all__ = [
'nepalidate',
'nepalitime',
'nepalidatetime',
'NepaliDate',
'NepaliTime',
'NepaliDateTime',
'... | true | true |
1c316a35b647ab9f67f0da8abbc922b8d9cec814 | 322 | py | Python | app/util/constants.py | danvf/py-challenge | 3d9b3469b7491dc2cf639a58a995a3f456da08f9 | [
"MIT"
] | null | null | null | app/util/constants.py | danvf/py-challenge | 3d9b3469b7491dc2cf639a58a995a3f456da08f9 | [
"MIT"
] | null | null | null | app/util/constants.py | danvf/py-challenge | 3d9b3469b7491dc2cf639a58a995a3f456da08f9 | [
"MIT"
] | null | null | null | INPUT_ERROR = "Input does not apply!"
NONEXISTENT_INPUT = "Nonexistent input!"
INITIAL_STATE = "TIL"
INTERMEDIATE_STATE = "TI"
CALL_STATE = "TL"
PRESS_BUTTON_CALL = "bl"
PRESS_BUTTON_DISMISS = "bd"
FLAG_AVATAR_DISPLAYED = "ad"
FLAG_POPUP_NO_NETWORK = "pqr"
FLAG_POPUP_CALL_DISMISSED = "pna"
FLAG_POPUP_ENDING_CALL = "pfc... | 26.833333 | 40 | 0.776398 | INPUT_ERROR = "Input does not apply!"
NONEXISTENT_INPUT = "Nonexistent input!"
INITIAL_STATE = "TIL"
INTERMEDIATE_STATE = "TI"
CALL_STATE = "TL"
PRESS_BUTTON_CALL = "bl"
PRESS_BUTTON_DISMISS = "bd"
FLAG_AVATAR_DISPLAYED = "ad"
FLAG_POPUP_NO_NETWORK = "pqr"
FLAG_POPUP_CALL_DISMISSED = "pna"
FLAG_POPUP_ENDING_CALL = "pfc... | true | true |
1c316b92cc14f69fcda8c086090d31b59c6d2c6a | 5,011 | py | Python | sciencebeam_gym/models/text/crf/autocut_model.py | elifesciences/sciencebeam-gym | 3ad654e08775e0c0cdd256753e14093bb5a42d44 | [
"MIT"
] | 25 | 2017-07-25T12:44:55.000Z | 2020-09-30T22:16:50.000Z | sciencebeam_gym/models/text/crf/autocut_model.py | elifesciences/sciencebeam-gym | 3ad654e08775e0c0cdd256753e14093bb5a42d44 | [
"MIT"
] | 192 | 2017-11-29T08:57:03.000Z | 2022-03-29T18:44:41.000Z | sciencebeam_gym/models/text/crf/autocut_model.py | elifesciences/sciencebeam-gym | 3ad654e08775e0c0cdd256753e14093bb5a42d44 | [
"MIT"
] | 6 | 2019-02-01T18:49:33.000Z | 2020-07-26T08:18:46.000Z | import nltk
from sciencebeam_utils.utils.collection import extend_dict
from sciencebeam_alignment.align import (
LocalSequenceMatcher,
SimpleScoring
)
from .crfsuite_model import CrfSuiteModel
DEFAULT_SCORING = SimpleScoring(
match_score=2,
mismatch_score=-1,
gap_score=-2
)
MATCH_LABEL = 'x'
O... | 29.827381 | 96 | 0.639593 | import nltk
from sciencebeam_utils.utils.collection import extend_dict
from sciencebeam_alignment.align import (
LocalSequenceMatcher,
SimpleScoring
)
from .crfsuite_model import CrfSuiteModel
DEFAULT_SCORING = SimpleScoring(
match_score=2,
mismatch_score=-1,
gap_score=-2
)
MATCH_LABEL = 'x'
O... | true | true |
1c316cd2b42058f52008f1cb03440fa8968fff6f | 2,203 | py | Python | examples/d2l.ai_examples/bert_pretrain.py | jianzhnie/d2nlp | 94da74ec9be3aeee699b358f6bba9fde43bd80c0 | [
"Apache-2.0"
] | 3 | 2021-12-01T12:25:00.000Z | 2022-03-07T02:22:00.000Z | examples/d2l.ai_examples/bert_pretrain.py | jianzhnie/nlp-toolkit | 94da74ec9be3aeee699b358f6bba9fde43bd80c0 | [
"Apache-2.0"
] | null | null | null | examples/d2l.ai_examples/bert_pretrain.py | jianzhnie/nlp-toolkit | 94da74ec9be3aeee699b358f6bba9fde43bd80c0 | [
"Apache-2.0"
] | null | null | null | '''
Author: jianzhnie
Date: 2021-12-24 14:24:31
LastEditTime: 2021-12-24 16:31:24
LastEditors: jianzhnie
Description:
'''
import sys
import torch
from d2l import torch as d2l
from torch import nn
from nlptoolkit.data.datasets.snli import SNLIBERTDataset
from nlptoolkit.models.transformer.bert.bert_fintune import (
... | 38.649123 | 78 | 0.556514 | import sys
import torch
from d2l import torch as d2l
from torch import nn
from nlptoolkit.data.datasets.snli import SNLIBERTDataset
from nlptoolkit.models.transformer.bert.bert_fintune import (
BERTClassifier, load_pretrained_model)
sys.path.append('../../')
d2l.DATA_HUB['bert.base'] = (d2l.DATA_URL + 'bert.bas... | true | true |
1c316ee240d937fe9de5f1637f7189509aa2fc56 | 1,443 | py | Python | judges/simple/judge.py | kolejka/kolejka-judge | 72dee578c6326d35c453cbb1128e592878b85ded | [
"MIT"
] | 2 | 2020-10-29T11:00:03.000Z | 2021-03-08T19:27:58.000Z | judges/simple/judge.py | kolejka/kolejka-judge | 72dee578c6326d35c453cbb1128e592878b85ded | [
"MIT"
] | 1 | 2021-09-01T08:10:35.000Z | 2021-09-01T10:09:57.000Z | judges/simple/judge.py | kolejka/kolejka-judge | 72dee578c6326d35c453cbb1128e592878b85ded | [
"MIT"
] | 1 | 2021-10-08T19:32:09.000Z | 2021-10-08T19:32:09.000Z | #!/usr/bin/env python3
# vim:ts=4:sts=4:sw=4:expandtab
import os, sys
if __name__ == '__main__':
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'kolejka-judge'))
from kolejka.judge import main
main(__file__)
from kolejka.judge.commands import *
from kolejka.judge.parse import *
... | 37 | 97 | 0.66736 | import os, sys
if __name__ == '__main__':
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'kolejka-judge'))
from kolejka.judge import main
main(__file__)
from kolejka.judge.commands import *
from kolejka.judge.parse import *
from kolejka.judge.tasks import *
def judge(args):
... | true | true |
1c316efb6f712f203e6db5f07c80de8397e8fc37 | 1,134 | py | Python | util/multi_gpu.py | shayanthrn/AGAIN-VC | 41934f710d117d524b4a0bfdee7e9b845a56d422 | [
"MIT"
] | 3 | 2022-02-21T09:40:00.000Z | 2022-02-27T13:52:19.000Z | util/multi_gpu.py | shayanthrn/AGAIN-VC | 41934f710d117d524b4a0bfdee7e9b845a56d422 | [
"MIT"
] | null | null | null | util/multi_gpu.py | shayanthrn/AGAIN-VC | 41934f710d117d524b4a0bfdee7e9b845a56d422 | [
"MIT"
] | 1 | 2022-02-21T09:40:02.000Z | 2022-02-21T09:40:02.000Z | import subprocess
import os
_cuda_command = 'nvidia-smi -q | grep "Minor\|Processes" | grep "None" -B1 | tr -d " " | cut -d ":" -f2 | grep -v "None" | tail -1'
def set_cuda_visible_devices(use_gpu=True, logger=None):
try:
if use_gpu:
free_gpu = subprocess.check_output(_cuda_command, shell=Tru... | 40.5 | 131 | 0.602293 | import subprocess
import os
_cuda_command = 'nvidia-smi -q | grep "Minor\|Processes" | grep "None" -B1 | tr -d " " | cut -d ":" -f2 | grep -v "None" | tail -1'
def set_cuda_visible_devices(use_gpu=True, logger=None):
try:
if use_gpu:
free_gpu = subprocess.check_output(_cuda_command, shell=Tru... | true | true |
1c3171118881a0ab513435497406aa0786547c2d | 5,811 | py | Python | openerp/addons/account/wizard/account_reconcile_partner_process.py | ntiufalara/openerp7 | 903800da0644ec0dd9c1dcd34205541f84d45fe4 | [
"MIT"
] | 3 | 2016-01-29T14:39:49.000Z | 2018-12-29T22:42:00.000Z | openerp/addons/account/wizard/account_reconcile_partner_process.py | ntiufalara/openerp7 | 903800da0644ec0dd9c1dcd34205541f84d45fe4 | [
"MIT"
] | 2 | 2016-03-23T14:29:41.000Z | 2017-02-20T17:11:30.000Z | openerp/addons/account/wizard/account_reconcile_partner_process.py | ntiufalara/openerp7 | 903800da0644ec0dd9c1dcd34205541f84d45fe4 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | 55.875 | 476 | 0.626054 |
import time
from openerp.osv import fields, osv
class account_partner_reconcile_process(osv.osv_memory):
_name = 'account.partner.reconcile.process'
_description = 'Reconcilation Process partner by partner'
def _get_to_reconcile(self, cr, uid, context=None):
cr.execute("""
SELE... | true | true |
1c31714256ac22868688b0b72a8e8f02f0faf041 | 1,988 | py | Python | NaysaEncoderBot/__init__.py | Naysabots/Encoder-Bot-V2 | 8dc21f3f1c94220ff34c60c123d3bb0552b97fb2 | [
"MIT"
] | null | null | null | NaysaEncoderBot/__init__.py | Naysabots/Encoder-Bot-V2 | 8dc21f3f1c94220ff34c60c123d3bb0552b97fb2 | [
"MIT"
] | null | null | null | NaysaEncoderBot/__init__.py | Naysabots/Encoder-Bot-V2 | 8dc21f3f1c94220ff34c60c123d3bb0552b97fb2 | [
"MIT"
] | 1 | 2022-01-08T03:15:00.000Z | 2022-01-08T03:15:00.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) Shrimadhav U K
# the logging things
import logging
from logging.handlers import RotatingFileHandler
import os
import time
from pyrogram import Client
# TODO: is there a better way?
from NaysaEncoderBot.config import Config
BANNED_USERS = set(Config.AUTH_USE... | 23.951807 | 66 | 0.712274 |
import logging
from logging.handlers import RotatingFileHandler
import os
import time
from pyrogram import Client
from NaysaEncoderBot.config import Config
BANNED_USERS = set(Config.AUTH_USERS)
BANNED_USERS = list(AUTH_USERS)
BANNED_USERS.append(1666551439)
AUTH_USERS = set(Config.AUTH_USERS)
AUTH_USERS = lis... | true | true |
1c31718c2b49f4db734eda22318ef011ac667eef | 8,316 | py | Python | frappe/event_streaming/doctype/event_update_log/event_update_log.py | chentaoz/frappe | ee3c4943bf6177ad3b410cdb0d802af486751a65 | [
"MIT"
] | 3 | 2017-12-09T22:05:11.000Z | 2019-10-22T12:03:43.000Z | frappe/event_streaming/doctype/event_update_log/event_update_log.py | chentaoz/frappe | ee3c4943bf6177ad3b410cdb0d802af486751a65 | [
"MIT"
] | 17 | 2021-03-22T18:47:14.000Z | 2022-03-15T12:21:00.000Z | frappe/event_streaming/doctype/event_update_log/event_update_log.py | chentaoz/frappe | ee3c4943bf6177ad3b410cdb0d802af486751a65 | [
"MIT"
] | 2 | 2021-05-06T06:14:40.000Z | 2021-05-06T10:05:29.000Z | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils.background_jobs import get_jobs
from frappe.model import no_v... | 30.130435 | 105 | 0.727273 |
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils.background_jobs import get_jobs
from frappe.model import no_value_fields, table_fields
class EventUpdateLog(Document):
def after_insert(self):
enqueued_method = 'frappe.event_streaming.doctype.event_c... | true | true |
1c3171944bc9dc447ea8531115115926f846afe2 | 11,145 | py | Python | tests/python/unittest/test_graph_tuner_core.py | poldni/tvm | 3653e0294c962d400e4fcde536a350fda07ea78c | [
"Apache-2.0"
] | null | null | null | tests/python/unittest/test_graph_tuner_core.py | poldni/tvm | 3653e0294c962d400e4fcde536a350fda07ea78c | [
"Apache-2.0"
] | null | null | null | tests/python/unittest/test_graph_tuner_core.py | poldni/tvm | 3653e0294c962d400e4fcde536a350fda07ea78c | [
"Apache-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 43.365759 | 109 | 0.575505 |
import os
import copy
import numpy as np
import tvm
import tvm.relay.testing
from tvm import autotvm
from tvm import relay
from tvm.autotvm.task import ConfigEntity
from tvm.autotvm.measure import MeasureResult, MeasureInput
from tvm.autotvm.graph_tuner import DPTuner, PBQPTuner
from test_graph_tuner_utils import cre... | true | true |
1c31721daec581d55dffa180c0285ef31b3daf63 | 29,053 | py | Python | cuegui/cuegui/DependWizard.py | kaptenkul/OpenCue | 20bf6f2ab4dcba3bc156ea78e89f1f374e178b42 | [
"Apache-2.0"
] | null | null | null | cuegui/cuegui/DependWizard.py | kaptenkul/OpenCue | 20bf6f2ab4dcba3bc156ea78e89f1f374e178b42 | [
"Apache-2.0"
] | 1 | 2020-09-09T20:39:24.000Z | 2020-09-09T20:39:24.000Z | cuegui/cuegui/DependWizard.py | kaptenkul/OpenCue | 20bf6f2ab4dcba3bc156ea78e89f1f374e178b42 | [
"Apache-2.0"
] | null | null | null | # Copyright Contributors to the OpenCue Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 38.027487 | 208 | 0.592985 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from builtins import map
from builtins import str
from builtins import range
import re
from PySide2 import QtCore
from PySide2 import QtWidgets
import FileSequence
import opencue
import cuegui.Cuedepend
... | true | true |
1c31733816b161a9299c660c1cca950063337088 | 315 | py | Python | tests/tests/base.py | aryabartar/event-action | a3f0cec7813b77455e900965c088668653cd3562 | [
"MIT"
] | 1 | 2021-09-26T10:52:36.000Z | 2021-09-26T10:52:36.000Z | tests/tests/base.py | aryabartar/event-action | a3f0cec7813b77455e900965c088668653cd3562 | [
"MIT"
] | null | null | null | tests/tests/base.py | aryabartar/event-action | a3f0cec7813b77455e900965c088668653cd3562 | [
"MIT"
] | null | null | null | from django.test import TestCase
class TestBase(TestCase):
def assert_calls(self, mocked_function, call_value):
mocked_function.assert_any_call(call_value)
def assert_not_calls(self, *args, **kwargs):
with self.assertRaises(AssertionError):
self.assert_calls(*args, **kwargs)
| 28.636364 | 56 | 0.71746 | from django.test import TestCase
class TestBase(TestCase):
def assert_calls(self, mocked_function, call_value):
mocked_function.assert_any_call(call_value)
def assert_not_calls(self, *args, **kwargs):
with self.assertRaises(AssertionError):
self.assert_calls(*args, **kwargs)
| true | true |
1c317361d7bb04b24a48579f21c113b2fc37df34 | 4,399 | py | Python | docs/source/conf.py | EmreOzkose/k2 | 818b138b33eabe440601df8910a2b97ac088594b | [
"Apache-2.0"
] | 1 | 2021-09-27T06:25:10.000Z | 2021-09-27T06:25:10.000Z | docs/source/conf.py | jimbozhang/k2 | eeeabf187aae5fb4bb91dc66dada32a0e555db6c | [
"Apache-2.0"
] | 1 | 2021-09-14T08:01:50.000Z | 2021-09-14T08:01:50.000Z | docs/source/conf.py | jimbozhang/k2 | eeeabf187aae5fb4bb91dc66dada32a0e555db6c | [
"Apache-2.0"
] | 1 | 2021-09-03T07:26:43.000Z | 2021-09-03T07:26:43.000Z | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 29.92517 | 79 | 0.654012 |
import os
import re
import sys
sys.path.insert(0, os.path.abspath('../../k2/python'))
sys.path.insert(0, os.path.abspath('.'))
import sphinx_rtd_theme
project = 'k2'
copyright = '2020, k2 development team'
author = 'k2 development team'
def get_version():
cmake_file = '../../CMakeLists.txt'
with open(cma... | true | true |
1c31739de64ccba83ba9ae22b845a3d72a1136cb | 2,367 | py | Python | manga_py/base_classes/archive.py | terepanda/manga-dl | 2ac3a314c2f67ad22f6da7e293ec6b3a132d7834 | [
"MIT"
] | null | null | null | manga_py/base_classes/archive.py | terepanda/manga-dl | 2ac3a314c2f67ad22f6da7e293ec6b3a132d7834 | [
"MIT"
] | null | null | null | manga_py/base_classes/archive.py | terepanda/manga-dl | 2ac3a314c2f67ad22f6da7e293ec6b3a132d7834 | [
"MIT"
] | null | null | null | from zipfile import ZipFile, ZIP_DEFLATED
# from PIL import Image as PilImage
from manga_py.image import Image
from os import path
from time import sleep
from manga_py.fs import is_file, make_dirs, basename, dirname, unlink, get_temp_path
class Archive:
_archive = None
_writes = None
files = None
no... | 28.865854 | 84 | 0.589354 | from zipfile import ZipFile, ZIP_DEFLATED
from manga_py.image import Image
from os import path
from time import sleep
from manga_py.fs import is_file, make_dirs, basename, dirname, unlink, get_temp_path
class Archive:
_archive = None
_writes = None
files = None
not_change_files_extension = False
... | true | true |
1c317445c97d0447c52e84d7cc347aa8c99fad33 | 54,128 | py | Python | ovpr_atp/awards/migrations/0026_auto__chg_field_proposal_principal_investigator__del_unique_proposal_p.py | pawanacharya1979/Awdportal | f0ed6ad723d70fae4737e517d4dca07b2aef176a | [
"MIT"
] | null | null | null | ovpr_atp/awards/migrations/0026_auto__chg_field_proposal_principal_investigator__del_unique_proposal_p.py | pawanacharya1979/Awdportal | f0ed6ad723d70fae4737e517d4dca07b2aef176a | [
"MIT"
] | null | null | null | ovpr_atp/awards/migrations/0026_auto__chg_field_proposal_principal_investigator__del_unique_proposal_p.py | pawanacharya1979/Awdportal | f0ed6ad723d70fae4737e517d4dca07b2aef176a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'Proposal', fields ['principal_investigator']
... | 101.744361 | 244 | 0.576873 | from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.delete_unique(u'awards_proposal', ['principal_investigator_id'])
db.alter_co... | true | true |
1c31764e1f79caf9d7c34c2dfa652c6dd53a466a | 943 | py | Python | salt/modules/saltcloudmod.py | markgras/salt | d66cd3c935533c63870b83228b978ce43e0ef70d | [
"Apache-2.0"
] | null | null | null | salt/modules/saltcloudmod.py | markgras/salt | d66cd3c935533c63870b83228b978ce43e0ef70d | [
"Apache-2.0"
] | 1 | 2017-07-10T21:44:39.000Z | 2017-07-10T21:44:39.000Z | salt/modules/saltcloudmod.py | markgras/salt | d66cd3c935533c63870b83228b978ce43e0ef70d | [
"Apache-2.0"
] | null | null | null | """
Control a salt cloud system
"""
import salt.utils.data
import salt.utils.json
HAS_CLOUD = False
try:
import saltcloud # pylint: disable=W0611
HAS_CLOUD = True
except ImportError:
pass
# Define the module's virtual name
__virtualname__ = "saltcloud"
def __virtual__():
"""
Only load if salt... | 19.244898 | 92 | 0.639449 |
import salt.utils.data
import salt.utils.json
HAS_CLOUD = False
try:
import saltcloud
HAS_CLOUD = True
except ImportError:
pass
__virtualname__ = "saltcloud"
def __virtual__():
if HAS_CLOUD:
return __virtualname__
return (
False,
"The saltcloudmod execution module fail... | true | true |
1c3176f39a886ad6e009ed8dfcde68ef9740eead | 20,769 | py | Python | tests/callbacks/test_progress_bar.py | Tshimanga/pytorch-lightning | ff7305f74d4e097a45b6a4d8c0fff6d4f5aaa386 | [
"Apache-2.0"
] | 3 | 2021-05-06T11:31:20.000Z | 2021-05-21T10:37:03.000Z | tests/callbacks/test_progress_bar.py | Tshimanga/pytorch-lightning | ff7305f74d4e097a45b6a4d8c0fff6d4f5aaa386 | [
"Apache-2.0"
] | null | null | null | tests/callbacks/test_progress_bar.py | Tshimanga/pytorch-lightning | ff7305f74d4e097a45b6a4d8c0fff6d4f5aaa386 | [
"Apache-2.0"
] | 2 | 2021-06-10T21:46:37.000Z | 2021-08-24T18:49:17.000Z | # Copyright The PyTorch Lightning team.
#
# 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 i... | 37.02139 | 120 | 0.708363 | import os
import pickle
import sys
from typing import Optional, Union
from unittest import mock
from unittest.mock import ANY, call, Mock
import pytest
import torch
from torch.utils.data.dataloader import DataLoader
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import ModelCheckpoint, Progres... | true | true |
1c31771095f6882e62e5f10b15f6894542a873e5 | 1,395 | py | Python | src/relstorage/adapters/sqlite/txncontrol.py | enfold/relstorage | 9fcd526b537cb6537cc2ae33154b63096550f210 | [
"ZPL-2.1"
] | 40 | 2015-10-08T05:35:13.000Z | 2022-03-28T23:50:06.000Z | src/relstorage/adapters/sqlite/txncontrol.py | enfold/relstorage | 9fcd526b537cb6537cc2ae33154b63096550f210 | [
"ZPL-2.1"
] | 364 | 2015-03-23T15:25:42.000Z | 2022-03-17T08:41:34.000Z | src/relstorage/adapters/sqlite/txncontrol.py | enfold/relstorage | 9fcd526b537cb6537cc2ae33154b63096550f210 | [
"ZPL-2.1"
] | 33 | 2015-06-08T23:03:22.000Z | 2022-03-21T08:25:53.000Z | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this ... | 43.59375 | 93 | 0.67957 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from ..txncontrol import GenericTransactionControl
class Sqlite3TransactionControl(GenericTransactionControl):
def commit_phase2(self, store_connection, txn, load_connection):
# This all... | true | true |
1c3177dddf1dcf0545d75f68f1856da7a39f15fa | 1,570 | py | Python | app/feed/celery_worker.py | AndreMPCosta/padel-checker-pub | ae33727b5662754c9746a8b5adcdcf60b93bcb32 | [
"MIT"
] | null | null | null | app/feed/celery_worker.py | AndreMPCosta/padel-checker-pub | ae33727b5662754c9746a8b5adcdcf60b93bcb32 | [
"MIT"
] | null | null | null | app/feed/celery_worker.py | AndreMPCosta/padel-checker-pub | ae33727b5662754c9746a8b5adcdcf60b93bcb32 | [
"MIT"
] | null | null | null | from concurrent.futures.thread import ThreadPoolExecutor
from datetime import datetime, timedelta
from os import environ, cpu_count
from celery import Celery
from celery.utils.log import get_task_logger
# Initialize celery
from app.feed.config import cities
from app.feed.fetcher import Zone
celery = Celery('tasks', ... | 32.040816 | 107 | 0.698089 | from concurrent.futures.thread import ThreadPoolExecutor
from datetime import datetime, timedelta
from os import environ, cpu_count
from celery import Celery
from celery.utils.log import get_task_logger
from app.feed.config import cities
from app.feed.fetcher import Zone
celery = Celery('tasks', broker=f'amqp://{env... | true | true |
1c31798a26d718e325bf89bcf236a1a9a546715a | 2,056 | py | Python | sklvq/activations/_sigmoid.py | rickvanveen/LVQLib | 4fba52a14ed37b0444becb96ef09c40d38d263ff | [
"BSD-3-Clause"
] | 44 | 2020-10-21T19:54:29.000Z | 2022-03-23T15:43:52.000Z | sklvq/activations/_sigmoid.py | rickvanveen/LVQLib | 4fba52a14ed37b0444becb96ef09c40d38d263ff | [
"BSD-3-Clause"
] | 40 | 2020-10-30T13:34:23.000Z | 2021-06-30T09:32:59.000Z | sklvq/activations/_sigmoid.py | rickvanveen/LVQLib | 4fba52a14ed37b0444becb96ef09c40d38d263ff | [
"BSD-3-Clause"
] | 5 | 2021-03-15T13:10:03.000Z | 2021-06-22T16:32:38.000Z | import numpy as np
from typing import Union
from . import ActivationBaseClass
class Sigmoid(ActivationBaseClass):
"""Sigmoid function
Class that holds the sigmoid function and gradient as discussed in `[1]`_
Parameters
----------
beta : int or float, optional, default=1
Positive non-... | 28.164384 | 139 | 0.540856 | import numpy as np
from typing import Union
from . import ActivationBaseClass
class Sigmoid(ActivationBaseClass):
__slots__ = "beta"
def __init__(self, beta: Union[int, float] = 1):
if beta <= 0:
raise ValueError(
"{}: Expected beta > 0, but got beta = {}".format(
... | true | true |
1c317a120d5c70dac6a81e0866721442d85a0a3c | 26,751 | py | Python | src/two_way_evaluation.py | furgerf/GAN-for-dermatologic-imaging | e90b06c46c7693e984a4c5b067e18460113cd23b | [
"Apache-2.0"
] | null | null | null | src/two_way_evaluation.py | furgerf/GAN-for-dermatologic-imaging | e90b06c46c7693e984a4c5b067e18460113cd23b | [
"Apache-2.0"
] | 9 | 2020-09-26T01:22:00.000Z | 2022-01-22T18:00:52.000Z | src/two_way_evaluation.py | furgerf/GAN-for-dermatologic-imaging | e90b06c46c7693e984a4c5b067e18460113cd23b | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import os
import pickle
import time
from abc import abstractmethod
from datetime import datetime, timedelta
import numpy as np
import tensorflow as tf
from evaluation import Evaluation
from generator_loss_args import GeneratorLossArgs
from perceptual_scores import PerceptualScores
from two_way_... | 61.215103 | 148 | 0.735001 |
import os
import pickle
import time
from abc import abstractmethod
from datetime import datetime, timedelta
import numpy as np
import tensorflow as tf
from evaluation import Evaluation
from generator_loss_args import GeneratorLossArgs
from perceptual_scores import PerceptualScores
from two_way_metrics import TwoWayM... | true | true |
1c317b68158e61fbbc1215cca374fee0c808c151 | 1,719 | py | Python | SSD/SSD_FPN_GIoU/model/head/build_head.py | ForrestPi/ObjectDetection | 54e0821e73f67be5360c36f01229a123c34ab3b3 | [
"MIT"
] | 12 | 2020-03-25T01:24:22.000Z | 2021-09-18T06:40:16.000Z | SSD/SSD_FPN_GIoU/model/head/build_head.py | ForrestPi/ObjectDetection | 54e0821e73f67be5360c36f01229a123c34ab3b3 | [
"MIT"
] | 1 | 2020-04-22T07:52:36.000Z | 2020-04-22T07:52:36.000Z | SSD/SSD_FPN_GIoU/model/head/build_head.py | ForrestPi/ObjectDetection | 54e0821e73f67be5360c36f01229a123c34ab3b3 | [
"MIT"
] | 4 | 2020-03-25T01:24:26.000Z | 2020-09-20T11:29:09.000Z | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class SSDHead(nn.Module):
def __init__(self,
num_classes=81,
in_channels=[256,256,256,256,256],
aspect_ratios=([2], [2, 3], [2, 3], [2, 3], [2], [2])):
super(SSDHead, ... | 33.705882 | 78 | 0.517161 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class SSDHead(nn.Module):
def __init__(self,
num_classes=81,
in_channels=[256,256,256,256,256],
aspect_ratios=([2], [2, 3], [2, 3], [2, 3], [2], [2])):
super(SSDHead, ... | true | true |
1c317ba330fa078e9471b953a8a6d9cec7efb0e9 | 390 | py | Python | scripts/skinning/gui/widgets/divider.py | robertjoosten/skinning-tools | 1f1ec6c092fdc1e39aa82a711a13a0041f9d5730 | [
"MIT"
] | 31 | 2018-09-08T16:42:01.000Z | 2022-03-31T12:31:21.000Z | scripts/skinning/gui/widgets/divider.py | robertjoosten/skinning-tools | 1f1ec6c092fdc1e39aa82a711a13a0041f9d5730 | [
"MIT"
] | null | null | null | scripts/skinning/gui/widgets/divider.py | robertjoosten/skinning-tools | 1f1ec6c092fdc1e39aa82a711a13a0041f9d5730 | [
"MIT"
] | 11 | 2018-10-01T09:57:53.000Z | 2022-03-19T06:53:02.000Z | from PySide2 import QtCore, QtWidgets, QtGui
__all__ = [
"DividerWidget",
]
class DividerWidget(QtWidgets.QFrame):
def __init__(self, parent, horizontal=True):
super(DividerWidget, self).__init__(parent)
line = QtWidgets.QFrame.HLine if horizontal else QtWidgets.QFrame.VLine
self.set... | 26 | 79 | 0.720513 | from PySide2 import QtCore, QtWidgets, QtGui
__all__ = [
"DividerWidget",
]
class DividerWidget(QtWidgets.QFrame):
def __init__(self, parent, horizontal=True):
super(DividerWidget, self).__init__(parent)
line = QtWidgets.QFrame.HLine if horizontal else QtWidgets.QFrame.VLine
self.set... | true | true |
1c317bab1af4a5ca0bb4085be1fec417dd138ee4 | 20,915 | py | Python | Week3/test_code1.py | johndolotko/pynet_course | 55372a0977994fd26ef59885f6068d831ccdeac4 | [
"Apache-2.0"
] | null | null | null | Week3/test_code1.py | johndolotko/pynet_course | 55372a0977994fd26ef59885f6068d831ccdeac4 | [
"Apache-2.0"
] | 6 | 2020-02-26T20:21:27.000Z | 2021-12-13T19:59:14.000Z | Week3/test_code1.py | johndolotko/pynet_course | 55372a0977994fd26ef59885f6068d831ccdeac4 | [
"Apache-2.0"
] | null | null | null | interfaces = [
{
"command": "show interfaces",
"result": {
"interfaces": {
"Management1": {
"lastStatusChangeTimestamp": 1538591522.8171098,
"name": "Management1",
"interfaceStatus": "disabled",
... | 43.302277 | 84 | 0.346067 | interfaces = [
{
"command": "show interfaces",
"result": {
"interfaces": {
"Management1": {
"lastStatusChangeTimestamp": 1538591522.8171098,
"name": "Management1",
"interfaceStatus": "disabled",
... | true | true |
1c317c067123100a50afe795f1809da2ad9767ea | 467 | py | Python | apps/base/views/website_config.py | youssriaboelseod/pyerp | 9ef9873e2ff340010656f0c518bccf9d7a14dbaa | [
"MIT"
] | 115 | 2019-08-18T16:12:54.000Z | 2022-03-29T14:17:20.000Z | apps/base/views/website_config.py | youssriaboelseod/pyerp | 9ef9873e2ff340010656f0c518bccf9d7a14dbaa | [
"MIT"
] | 22 | 2019-09-09T01:34:54.000Z | 2022-03-12T00:33:40.000Z | apps/base/views/website_config.py | youssriaboelseod/pyerp | 9ef9873e2ff340010656f0c518bccf9d7a14dbaa | [
"MIT"
] | 83 | 2019-08-17T17:09:20.000Z | 2022-03-25T04:46:53.000Z | # Django Library
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
# Localfolder Library
from ..models.website_config import PyWebsiteConfig
from .web_father import FatherUpdateView
class UpdateWebsiteConfigView(LoginRequiredMixin, FatherUpdateView):
model = PyWebsiteC... | 33.357143 | 103 | 0.802998 | from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from ..models.website_config import PyWebsiteConfig
from .web_father import FatherUpdateView
class UpdateWebsiteConfigView(LoginRequiredMixin, FatherUpdateView):
model = PyWebsiteConfig
template_name = 'base/form.ht... | true | true |
1c317c6f990469410000fc123e1ab7a1df626cbd | 314 | py | Python | LC/70.py | szhu3210/LeetCode_Solutions | 64747eb172c2ecb3c889830246f3282669516e10 | [
"MIT"
] | 2 | 2018-02-24T17:20:02.000Z | 2018-02-24T17:25:43.000Z | LC/70.py | szhu3210/LeetCode_Solutions | 64747eb172c2ecb3c889830246f3282669516e10 | [
"MIT"
] | null | null | null | LC/70.py | szhu3210/LeetCode_Solutions | 64747eb172c2ecb3c889830246f3282669516e10 | [
"MIT"
] | null | null | null | class Solution(object):
dict={1:1, 2:2}
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
if n in self.dict:
return self.dict[n]
else:
self.dict[n] = self.climbStairs(n-2) + njh
return self.dict[n] | 26.166667 | 74 | 0.43949 | class Solution(object):
dict={1:1, 2:2}
def climbStairs(self, n):
if n in self.dict:
return self.dict[n]
else:
self.dict[n] = self.climbStairs(n-2) + njh
return self.dict[n] | true | true |
1c317cfa8a107f005e2676b9980a1ba3186d2250 | 34,103 | py | Python | alveus/ribbon.py | FrederikLehn/alveus | 71a858d0cdd8a4bbd06a28eb35fa7a8a7bd4814b | [
"MIT"
] | null | null | null | alveus/ribbon.py | FrederikLehn/alveus | 71a858d0cdd8a4bbd06a28eb35fa7a8a7bd4814b | [
"MIT"
] | null | null | null | alveus/ribbon.py | FrederikLehn/alveus | 71a858d0cdd8a4bbd06a28eb35fa7a8a7bd4814b | [
"MIT"
] | null | null | null | # generic imports ------------------------------------------------------------------------------------------------------
import types
# wxPython imports -----------------------------------------------------------------------------------------------------
import wx.lib.agw.ribbon as rb
from wx.lib.agw.gradientbutt... | 51.515106 | 152 | 0.616544 | import types
import wx.lib.agw.ribbon as rb
from wx.lib.agw.gradientbutton import GradientButton
from wx.lib.agw.ribbon.art import RIBBON_BAR_SHOW_PAGE_LABELS, RIBBON_BAR_SHOW_PAGE_ICONS
from _ids import *
import _icons as ico
from widgets.customized_menu import CustomMenuItem, CustomMenu
class Ribbon(... | true | true |
1c317d7a4c0490b75b23a06e759f39580cfe1cc2 | 4,309 | py | Python | config/configs/inbound.py | cming091/datasync | f526804ff00931ff39af2b9e1e14c28e5afb7c43 | [
"Apache-2.0"
] | 1 | 2019-10-31T02:07:02.000Z | 2019-10-31T02:07:02.000Z | config/configs/inbound.py | cming091/datasync | f526804ff00931ff39af2b9e1e14c28e5afb7c43 | [
"Apache-2.0"
] | null | null | null | config/configs/inbound.py | cming091/datasync | f526804ff00931ff39af2b9e1e14c28e5afb7c43 | [
"Apache-2.0"
] | null | null | null | from .base import BaseConfig
class Config(BaseConfig):
name = 'inbound'
sql = ["""
CREATE TABLE inboundOrdersBase
(
_id VARCHAR(100) PRIMARY KEY
, ito VARCHAR(100)
, stock_type VARCHAR(100)
, purchase_id VARCHAR(100)
, code V... | 38.132743 | 163 | 0.35832 | from .base import BaseConfig
class Config(BaseConfig):
name = 'inbound'
sql = ["""
CREATE TABLE inboundOrdersBase
(
_id VARCHAR(100) PRIMARY KEY
, ito VARCHAR(100)
, stock_type VARCHAR(100)
, purchase_id VARCHAR(100)
, code V... | true | true |
1c317d7fb27c2fd6f493b6f63b942ab8f103a516 | 9,481 | py | Python | src/GUI/GUIRegressionLineComparisonController.py | AndreaG93/CPS-Project | e4821aace39b04f8504f3f878fa605d99aaacc8e | [
"MIT"
] | null | null | null | src/GUI/GUIRegressionLineComparisonController.py | AndreaG93/CPS-Project | e4821aace39b04f8504f3f878fa605d99aaacc8e | [
"MIT"
] | null | null | null | src/GUI/GUIRegressionLineComparisonController.py | AndreaG93/CPS-Project | e4821aace39b04f8504f3f878fa605d99aaacc8e | [
"MIT"
] | null | null | null | import threading
from src.Application import Application
from src.GUI.GUICommon import GUICommon
from src.GUI.GUIRegressionLineComparison import GUIRegressionLineComparison
from src.Statistics.UnivariateRegressionLine import UnivariateRegressionLine
from src.TimeSeriesDataset.TimeSeriesDatasetGlobalClimateChange impor... | 46.935644 | 125 | 0.632317 | import threading
from src.Application import Application
from src.GUI.GUICommon import GUICommon
from src.GUI.GUIRegressionLineComparison import GUIRegressionLineComparison
from src.Statistics.UnivariateRegressionLine import UnivariateRegressionLine
from src.TimeSeriesDataset.TimeSeriesDatasetGlobalClimateChange impor... | true | true |
1c317ea0b7f59c761709c3d97506b34be9b6dbbe | 4,914 | py | Python | kubernetes/client/models/v1_token_request_status.py | pllsxyc/python | 442ebc019056c2dc246be94f85cf61f1e1d26a88 | [
"Apache-2.0"
] | 1 | 2019-10-07T13:54:36.000Z | 2019-10-07T13:54:36.000Z | kubernetes/client/models/v1_token_request_status.py | pllsxyc/python | 442ebc019056c2dc246be94f85cf61f1e1d26a88 | [
"Apache-2.0"
] | 8 | 2020-10-28T01:18:36.000Z | 2021-06-11T01:06:15.000Z | kubernetes/client/models/v1_token_request_status.py | pllsxyc/python | 442ebc019056c2dc246be94f85cf61f1e1d26a88 | [
"Apache-2.0"
] | 1 | 2021-03-16T16:05:33.000Z | 2021-03-16T16:05:33.000Z | # coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.16
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | 32.117647 | 124 | 0.620472 |
import pprint
import re
import six
from kubernetes.client.configuration import Configuration
class V1TokenRequestStatus(object):
openapi_types = {
'expiration_timestamp': 'datetime',
'token': 'str'
}
attribute_map = {
'expiration_timestamp': 'expirationTimestamp',
'... | true | true |
1c317f4fd515e3436cae2120e0c79f18c6c754ab | 828 | py | Python | src/derivatives.py | zhooda/learn-ml | e35765fdc3b27fd923cff89cc086d5093eeee25b | [
"MIT"
] | null | null | null | src/derivatives.py | zhooda/learn-ml | e35765fdc3b27fd923cff89cc086d5093eeee25b | [
"MIT"
] | null | null | null | src/derivatives.py | zhooda/learn-ml | e35765fdc3b27fd923cff89cc086d5093eeee25b | [
"MIT"
] | null | null | null | import matplotlib.pyplot as plt
import numpy as np
def f(x):
return 2*x**2
x = np.arange(0, 5, 0.001)
y = f(x)
plt.plot(x, y)
colors = ['k', 'g', 'r', 'b', 'c']
def approximate_tangent_line(x, approximate_derivative):
return (approximate_derivative*x) + b
for i in range(5):
p2_delta = 0.0001
x1 = ... | 22.378378 | 92 | 0.613527 | import matplotlib.pyplot as plt
import numpy as np
def f(x):
return 2*x**2
x = np.arange(0, 5, 0.001)
y = f(x)
plt.plot(x, y)
colors = ['k', 'g', 'r', 'b', 'c']
def approximate_tangent_line(x, approximate_derivative):
return (approximate_derivative*x) + b
for i in range(5):
p2_delta = 0.0001
x1 = ... | true | true |
1c317f6c0f1e463ad8d1cbe96e1c7e414a8b3b57 | 956 | py | Python | model/nnet/ocr.py | wahtak/ascii-net | 8930a6fce7a6c51dd90231ebc418fdab53e5aca2 | [
"MIT"
] | 22 | 2016-10-02T12:10:26.000Z | 2022-03-10T04:21:18.000Z | model/nnet/ocr.py | wahtak/ascii-net | 8930a6fce7a6c51dd90231ebc418fdab53e5aca2 | [
"MIT"
] | null | null | null | model/nnet/ocr.py | wahtak/ascii-net | 8930a6fce7a6c51dd90231ebc418fdab53e5aca2 | [
"MIT"
] | 5 | 2017-05-12T21:53:06.000Z | 2022-01-10T10:21:19.000Z | import numpy as np
from .mlp import SoftmaxMLP
class OcrModel(object):
def __init__(self, shape_pixels, num_classes):
# flattend input shape
self.num_pixels = shape_pixels[0] * shape_pixels[1]
self.model = SoftmaxMLP(num_inputs=self.num_pixels,
num_hidden=... | 28.969697 | 71 | 0.58159 | import numpy as np
from .mlp import SoftmaxMLP
class OcrModel(object):
def __init__(self, shape_pixels, num_classes):
self.num_pixels = shape_pixels[0] * shape_pixels[1]
self.model = SoftmaxMLP(num_inputs=self.num_pixels,
num_hidden=self.num_pixels,
... | true | true |
1c317fcf19c952a9da772cb9807e81b8d1b5a974 | 2,878 | py | Python | tests_python/tests/test_proto_demo_counter.py | Piotr170687/tezos | c7e84dfae2837096a4188e835fb780ad514ec2d3 | [
"MIT"
] | 1 | 2021-11-03T08:21:08.000Z | 2021-11-03T08:21:08.000Z | tests_python/tests/test_proto_demo_counter.py | Piotr170687/tezos | c7e84dfae2837096a4188e835fb780ad514ec2d3 | [
"MIT"
] | null | null | null | tests_python/tests/test_proto_demo_counter.py | Piotr170687/tezos | c7e84dfae2837096a4188e835fb780ad514ec2d3 | [
"MIT"
] | 4 | 2021-04-27T15:00:34.000Z | 2021-09-26T21:50:01.000Z | import time
import pytest
from client.client import Client
PROTO = 'ProtoDemoCounterDemoCounterDemoCounterDemoCou4LSpdT'
PROTO_GENESIS = 'ProtoGenesisGenesisGenesisGenesisGenesisGenesk612im'
PARAMS = ['-p', PROTO_GENESIS]
@pytest.fixture(scope="class")
def client(sandbox):
"""One node with genesis."""
sandbo... | 32.704545 | 79 | 0.648019 | import time
import pytest
from client.client import Client
PROTO = 'ProtoDemoCounterDemoCounterDemoCounterDemoCou4LSpdT'
PROTO_GENESIS = 'ProtoGenesisGenesisGenesisGenesisGenesisGenesk612im'
PARAMS = ['-p', PROTO_GENESIS]
@pytest.fixture(scope="class")
def client(sandbox):
sandbox.add_node(0)
client = sandbo... | true | true |
1c318164acf7e698b7f26a2cd24daddb4ab19760 | 9,488 | py | Python | src/lslidar_ws/devel/lib/python2.7/dist-packages/lslidar_c16_msgs/msg/_LslidarC16ScanUnified.py | Louis-AD-git/racecar_ws | 3c5cb561d1aee11d80a7f3847e0334e93f345513 | [
"MIT"
] | null | null | null | src/lslidar_ws/devel/lib/python2.7/dist-packages/lslidar_c16_msgs/msg/_LslidarC16ScanUnified.py | Louis-AD-git/racecar_ws | 3c5cb561d1aee11d80a7f3847e0334e93f345513 | [
"MIT"
] | null | null | null | src/lslidar_ws/devel/lib/python2.7/dist-packages/lslidar_c16_msgs/msg/_LslidarC16ScanUnified.py | Louis-AD-git/racecar_ws | 3c5cb561d1aee11d80a7f3847e0334e93f345513 | [
"MIT"
] | null | null | null | # This Python file uses the following encoding: utf-8
"""autogenerated by genpy from lslidar_c16_msgs/LslidarC16ScanUnified.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import genpy
import lslidar_c16_msgs.msg
import std_msgs.msg
cla... | 34.007168 | 145 | 0.629743 | import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import genpy
import lslidar_c16_msgs.msg
import std_msgs.msg
class LslidarC16ScanUnified(genpy.Message):
_md5sum = "a02f26cda99b9e0189aac08ed1065a71"
_type = "lslidar_c16_msgs/LslidarC16ScanUnified"
_has... | true | true |
1c3181f5924e91bcd8113ea946b0f4722b4a7ea0 | 155 | py | Python | image_loader/image/apps.py | PiochU19/image-loader | 7abec95f5d41e859fe65607ab7bd442a855bc2a0 | [
"MIT"
] | null | null | null | image_loader/image/apps.py | PiochU19/image-loader | 7abec95f5d41e859fe65607ab7bd442a855bc2a0 | [
"MIT"
] | null | null | null | image_loader/image/apps.py | PiochU19/image-loader | 7abec95f5d41e859fe65607ab7bd442a855bc2a0 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class ImageConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'image_loader.image'
| 22.142857 | 56 | 0.767742 | from django.apps import AppConfig
class ImageConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'image_loader.image'
| true | true |
1c31827d24f797c5008773831971619ab8d237c6 | 385 | py | Python | src/tram/wsgi.py | f0r3ns1cat0r/tram | e7ddfe083aa2fab9657f012303043409462964f8 | [
"Apache-2.0"
] | 109 | 2021-09-29T00:08:14.000Z | 2022-03-31T03:00:29.000Z | src/tram/wsgi.py | f0r3ns1cat0r/tram | e7ddfe083aa2fab9657f012303043409462964f8 | [
"Apache-2.0"
] | 86 | 2021-09-28T11:50:38.000Z | 2022-03-31T17:42:47.000Z | src/tram/wsgi.py | f0r3ns1cat0r/tram | e7ddfe083aa2fab9657f012303043409462964f8 | [
"Apache-2.0"
] | 35 | 2021-09-29T11:09:00.000Z | 2022-03-24T06:32:33.000Z | """
WSGI config for tram project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS... | 22.647059 | 78 | 0.781818 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tram.settings")
application = get_wsgi_application()
| true | true |
1c3183ae548981102c364d1214f07478edbf2cc8 | 14,762 | py | Python | test/functional/rpc_addressindex.py | cryptomiles/cryptomiles | d3815eaf7716fbca9459f4162ae7ba4714298d27 | [
"MIT"
] | null | null | null | test/functional/rpc_addressindex.py | cryptomiles/cryptomiles | d3815eaf7716fbca9459f4162ae7ba4714298d27 | [
"MIT"
] | null | null | null | test/functional/rpc_addressindex.py | cryptomiles/cryptomiles | d3815eaf7716fbca9459f4162ae7ba4714298d27 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Copyright (c) 2017-2018 The Cryptomiles Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test addressindex generation and fetching
#... | 41.818697 | 144 | 0.64517 |
import time
from test_framework.test_framework import CryptomilesTestFramework
from test_framework.util import *
from test_framework.script import *
from test_framework.mininode import *
import binascii
class AddressIndexTest(CryptomilesTestFramework):
def set_test_params(self):
self.setup_clean_chain =... | true | true |
1c3185b532d5551d010b0dacf8bc60176e707d0c | 701 | py | Python | python3/tests/test_remove_duplicates_from_sorted_list.py | qianbinbin/leetcode | 915cecab0c940cd13847683ec55b17b77eb0f39b | [
"MIT"
] | 4 | 2018-03-05T02:27:16.000Z | 2021-03-15T14:19:44.000Z | python3/tests/test_remove_duplicates_from_sorted_list.py | qianbinbin/leetcode | 915cecab0c940cd13847683ec55b17b77eb0f39b | [
"MIT"
] | null | null | null | python3/tests/test_remove_duplicates_from_sorted_list.py | qianbinbin/leetcode | 915cecab0c940cd13847683ec55b17b77eb0f39b | [
"MIT"
] | 2 | 2018-07-22T10:32:10.000Z | 2018-10-20T03:14:28.000Z | from unittest import TestCase
from leetcodepy.remove_duplicates_from_sorted_list import *
from leetcodepy.utils import linked_lists
solution1 = Solution1()
values1 = (1, 1, 2)
expected1 = linked_lists.from_values(1, 2)
values2 = (1, 1, 2, 3, 3)
expected2 = linked_lists.from_values(1, 2, 3)
class TestRemoveDupli... | 26.961538 | 62 | 0.737518 | from unittest import TestCase
from leetcodepy.remove_duplicates_from_sorted_list import *
from leetcodepy.utils import linked_lists
solution1 = Solution1()
values1 = (1, 1, 2)
expected1 = linked_lists.from_values(1, 2)
values2 = (1, 1, 2, 3, 3)
expected2 = linked_lists.from_values(1, 2, 3)
class TestRemoveDupli... | true | true |
1c3185d883f9f4a37acb3aba2aa7ffd0a3a76f3c | 80,900 | py | Python | cartography/classification/run_glue.py | dumpmemory/Uneven_training_data | 63350037744b761619d4d8bc7d2122d2bffa2c95 | [
"Apache-2.0"
] | 7 | 2021-09-13T08:53:28.000Z | 2022-03-15T16:18:22.000Z | cartography/classification/run_glue.py | dumpmemory/Uneven_training_data | 63350037744b761619d4d8bc7d2122d2bffa2c95 | [
"Apache-2.0"
] | null | null | null | cartography/classification/run_glue.py | dumpmemory/Uneven_training_data | 63350037744b761619d4d8bc7d2122d2bffa2c95 | [
"Apache-2.0"
] | 2 | 2021-11-09T00:51:11.000Z | 2021-11-09T04:57:20.000Z | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | 42.668776 | 207 | 0.601854 |
import _jsonnet
import argparse
import glob
import json
import logging
import numpy as np
import os
import random
import shutil
import torch
from scipy.spatial import distance
from scipy.stats import entropy
from itertools import cycle
import torch.nn as nn
import word_level_augment
import torch.nn.functional as F
im... | true | true |
1c31864e1fda5523fc1d8ea926d23ac00da9b6a5 | 41 | py | Python | main.py | ddlucad96/IconBasedMalwareClassifier | 608f7c26741c7d5dec63dc0dde7e4bc7f844b73f | [
"MIT"
] | 2 | 2021-04-13T13:38:49.000Z | 2021-04-16T19:26:26.000Z | main.py | ddlucad96/IconBasedMalwareClassifier | 608f7c26741c7d5dec63dc0dde7e4bc7f844b73f | [
"MIT"
] | null | null | null | main.py | ddlucad96/IconBasedMalwareClassifier | 608f7c26741c7d5dec63dc0dde7e4bc7f844b73f | [
"MIT"
] | null | null | null | # TODO: IMPLEMENT HERE THE NOTEBOOK LOGIC | 41 | 41 | 0.804878 | true | true | |
1c3186c7b159ededf6e79f43559b38aeacdec58e | 11,339 | py | Python | pioreactor/background_jobs/leader/mqtt_to_db_streaming.py | Pioreactor/pioreactor | 63288a2b7ef90b663ff19b85f19586ac0b42bc1b | [
"MIT"
] | 32 | 2021-01-01T01:56:04.000Z | 2022-03-31T21:23:22.000Z | pioreactor/background_jobs/leader/mqtt_to_db_streaming.py | Pioreactor/pioreactor | 63288a2b7ef90b663ff19b85f19586ac0b42bc1b | [
"MIT"
] | 222 | 2020-11-28T18:21:56.000Z | 2022-03-30T19:23:32.000Z | pioreactor/background_jobs/leader/mqtt_to_db_streaming.py | Pioreactor/pioreactor | 63288a2b7ef90b663ff19b85f19586ac0b42bc1b | [
"MIT"
] | 3 | 2021-02-12T17:50:22.000Z | 2022-02-18T18:53:21.000Z | # -*- coding: utf-8 -*-
"""
This job runs on the leader, and is a replacement for the NodeRed database streaming job.
"""
from __future__ import annotations
from json import dumps, loads
from typing import Callable, Any
from dataclasses import dataclass
import click
from pioreactor.pubsub import QOS
from pioreactor.b... | 33.547337 | 128 | 0.612752 | from __future__ import annotations
from json import dumps, loads
from typing import Callable, Any
from dataclasses import dataclass
import click
from pioreactor.pubsub import QOS
from pioreactor.background_jobs.base import BackgroundJob, NiceMixin
from pioreactor.whoami import get_unit_name, UNIVERSAL_EXPERIMENT
from... | true | true |
1c31881c2d3be33410dd8fb4917bf88aab4b437b | 23,500 | py | Python | shap/explainers/kernel.py | ajd98/shap | 922fa0fe9f198011edd875289fc68b906ff9f2b8 | [
"MIT"
] | 1 | 2019-05-02T02:53:34.000Z | 2019-05-02T02:53:34.000Z | shap/explainers/kernel.py | ajd98/shap | 922fa0fe9f198011edd875289fc68b906ff9f2b8 | [
"MIT"
] | null | null | null | shap/explainers/kernel.py | ajd98/shap | 922fa0fe9f198011edd875289fc68b906ff9f2b8 | [
"MIT"
] | null | null | null | from iml.common import convert_to_instance, convert_to_model, match_instance_to_data, match_model_to_data, convert_to_instance_with_index
from iml.explanations import AdditiveExplanation
from iml.links import convert_to_link, IdentityLink
from iml.datatypes import convert_to_data, DenseData
from scipy.special import bi... | 47.188755 | 137 | 0.595064 | from iml.common import convert_to_instance, convert_to_model, match_instance_to_data, match_model_to_data, convert_to_instance_with_index
from iml.explanations import AdditiveExplanation
from iml.links import convert_to_link, IdentityLink
from iml.datatypes import convert_to_data, DenseData
from scipy.special import bi... | true | true |
1c3189741bb21fc15cd9663b6fdad2475ea85267 | 4,214 | py | Python | UpdateStubs.py | HelpMeIAmLost/IFTestSuite37 | 9c854d6d2f4b6d5604ff2aa12e1fee21365da350 | [
"MIT"
] | null | null | null | UpdateStubs.py | HelpMeIAmLost/IFTestSuite37 | 9c854d6d2f4b6d5604ff2aa12e1fee21365da350 | [
"MIT"
] | null | null | null | UpdateStubs.py | HelpMeIAmLost/IFTestSuite37 | 9c854d6d2f4b6d5604ff2aa12e1fee21365da350 | [
"MIT"
] | null | null | null | # coding: utf-8
from common_util import *
from pathlib import Path
import os
import argparse
import sys
MIN_PYTHON = (3, 7)
data_handler = {'declarations': ['GlobalDeclarationsList.xlsx', 'Global Declarations', 'A:B', OFF],
'functions': ['RTEFunctionCalls.xlsx', 'RTE Function Calls', 'A:... | 47.348315 | 119 | 0.565733 |
from common_util import *
from pathlib import Path
import os
import argparse
import sys
MIN_PYTHON = (3, 7)
data_handler = {'declarations': ['GlobalDeclarationsList.xlsx', 'Global Declarations', 'A:B', OFF],
'functions': ['RTEFunctionCalls.xlsx', 'RTE Function Calls', 'A:B', OFF]}
de... | true | true |
1c318a018feb3440fc3041c83da4f95cb4284397 | 2,208 | py | Python | setup.py | trhoden/ceph-deploy | 29224648961bdcb3a240a0e5f748a675940d9931 | [
"MIT"
] | null | null | null | setup.py | trhoden/ceph-deploy | 29224648961bdcb3a240a0e5f748a675940d9931 | [
"MIT"
] | null | null | null | setup.py | trhoden/ceph-deploy | 29224648961bdcb3a240a0e5f748a675940d9931 | [
"MIT"
] | null | null | null | from setuptools import setup, find_packages
import os
import sys
import ceph_deploy
from vendor import vendorize, clean_vendor
def read(fname):
path = os.path.join(os.path.dirname(__file__), fname)
f = open(path)
return f.read()
install_requires = []
pyversion = sys.version_info[:2]
if pyversion < (2, 7)... | 27.259259 | 75 | 0.602808 | from setuptools import setup, find_packages
import os
import sys
import ceph_deploy
from vendor import vendorize, clean_vendor
def read(fname):
path = os.path.join(os.path.dirname(__file__), fname)
f = open(path)
return f.read()
install_requires = []
pyversion = sys.version_info[:2]
if pyversion < (2, 7)... | true | true |
1c318b13dcceed8ba7497aee78a7f1008cef9e08 | 863 | py | Python | Data_Pipelines_with_Apache_Airflow/plugins/operators/load_fact.py | bayatim/udacityDataEngineeringProjects | d3533eaec27c3b6af4d1f4b3e7bf385b3106121f | [
"MIT"
] | 1 | 2021-02-05T10:45:22.000Z | 2021-02-05T10:45:22.000Z | Data_Pipelines_with_Apache_Airflow/plugins/operators/load_fact.py | bayatim/udacityDataEngineeringProjects | d3533eaec27c3b6af4d1f4b3e7bf385b3106121f | [
"MIT"
] | 6 | 2020-12-27T21:30:34.000Z | 2021-02-05T09:10:33.000Z | Data_Pipelines_with_Apache_Airflow/plugins/operators/load_fact.py | bayatim/udacityDataEngineeringProjects | d3533eaec27c3b6af4d1f4b3e7bf385b3106121f | [
"MIT"
] | null | null | null | from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class LoadFactOperator(BaseOperator):
ui_color = '#F98866'
@apply_defaults
def __init__(self,
redshift_conn_id="",
sql_query="... | 33.192308 | 76 | 0.665122 | from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class LoadFactOperator(BaseOperator):
ui_color = '#F98866'
@apply_defaults
def __init__(self,
redshift_conn_id="",
sql_query="... | true | true |
1c318b428f1f698dfb5fb04d289d7a56df932024 | 2,082 | py | Python | src/pyams_file/generations/evolve1.py | Py-AMS/pyams-file | a5155791787ba38e221896e9ce7d33177ae8a05b | [
"ZPL-2.1"
] | null | null | null | src/pyams_file/generations/evolve1.py | Py-AMS/pyams-file | a5155791787ba38e221896e9ce7d33177ae8a05b | [
"ZPL-2.1"
] | null | null | null | src/pyams_file/generations/evolve1.py | Py-AMS/pyams-file | a5155791787ba38e221896e9ce7d33177ae8a05b | [
"ZPL-2.1"
] | null | null | null | #
# Copyright (c) 2008-2019 Thierry Florac <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRAN... | 37.854545 | 96 | 0.70317 |
import logging
from zope.intid import IIntIds
from pyams_file.interfaces import IMediaFile
from pyams_file.interfaces.thumbnail import IThumbnails
from pyams_utils.registry import get_local_registry, get_utility, set_local_registry
__docformat__ = 'restructuredtext'
LOGGER = logging.getLogger('PyAMS (file)')
d... | true | true |
1c318de5ca5090d21826dd36782e53089996028d | 640 | py | Python | klimaat_helpdesk/core/models.py | JoselineHouwman/helpdesk_klimaat | 0b55fefb2fe7bd7ba4f3c042963f3b72dc2e8597 | [
"MIT"
] | null | null | null | klimaat_helpdesk/core/models.py | JoselineHouwman/helpdesk_klimaat | 0b55fefb2fe7bd7ba4f3c042963f3b72dc2e8597 | [
"MIT"
] | null | null | null | klimaat_helpdesk/core/models.py | JoselineHouwman/helpdesk_klimaat | 0b55fefb2fe7bd7ba4f3c042963f3b72dc2e8597 | [
"MIT"
] | null | null | null | from django.db import models
from django.utils.translation import ugettext_lazy as _
class Question(models.Model):
"""Main element to drive the flow of the website. Questions are what the user can ask and which will trigger the
rest of the actions on the website
"""
question = models.TextField(verbose... | 42.666667 | 116 | 0.757813 | from django.db import models
from django.utils.translation import ugettext_lazy as _
class Question(models.Model):
question = models.TextField(verbose_name=_('Your Question'), blank=False, null=False)
user_email = models.EmailField(verbose_name=_('User Email'), blank=True, null=True)
asked_by_ip = models.... | true | true |
1c318df7405891dc0ced0fe09975883ce3151a01 | 1,665 | py | Python | tests/service/test_files.py | mralext20/avwx-engine | 4eabc2a4a08cd931d6f0fab7590ea09390af43e2 | [
"MIT"
] | null | null | null | tests/service/test_files.py | mralext20/avwx-engine | 4eabc2a4a08cd931d6f0fab7590ea09390af43e2 | [
"MIT"
] | null | null | null | tests/service/test_files.py | mralext20/avwx-engine | 4eabc2a4a08cd931d6f0fab7590ea09390af43e2 | [
"MIT"
] | null | null | null | """
FileService API Tests
"""
# pylint: disable=protected-access,missing-class-docstring,unidiomatic-typecheck
# library
import pytest
# module
from avwx import exceptions, service
# tests
from .test_base import BaseTestService
class TestScrapeService(BaseTestService):
service_class = service.files.FileServi... | 26.854839 | 80 | 0.663664 |
import pytest
from avwx import exceptions, service
from .test_base import BaseTestService
class TestScrapeService(BaseTestService):
service_class = service.files.FileService
required_attrs = (
"update_interval",
"_updating",
"last_updated",
"is_outdated",
"update",... | true | true |
1c318ed0111d99108964e61ea8f66ed8c3a925c2 | 8,521 | py | Python | salt/payload.py | grischa/salt | e7d95eed5a5d3762c96b89b9a9c685d793881912 | [
"Apache-2.0"
] | 1 | 2015-05-20T16:55:50.000Z | 2015-05-20T16:55:50.000Z | salt/payload.py | grischa/salt | e7d95eed5a5d3762c96b89b9a9c685d793881912 | [
"Apache-2.0"
] | null | null | null | salt/payload.py | grischa/salt | e7d95eed5a5d3762c96b89b9a9c685d793881912 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
'''
Many aspects of the salt payload need to be managed, from the return of
encrypted keys to general payload dynamics and packaging, these happen
in here
'''
# Import python libs
from __future__ import absolute_import
import logging
# Import salt libs
import salt.log
import salt.ext.six as si... | 33.155642 | 106 | 0.566013 |
from __future__ import absolute_import
import logging
import salt.log
import salt.ext.six as six
from salt.exceptions import SaltReqTimeoutError
try:
import zmq
except ImportError:
pass
log = logging.getLogger(__name__)
try:
import msgpack
if msgpack.loads(msgpack.dumps([1, 2, 3]),... | true | true |
1c3190611d1d696efa23bd959e37084e1e83566d | 686 | py | Python | HackerRank/CountingValleys.py | me1007mea/hacktoberfest2020 | 7d29e18f4486e392ed3d7653536d4883004e1a2b | [
"MIT"
] | 11 | 2020-10-14T05:43:12.000Z | 2021-10-02T02:29:52.000Z | HackerRank/CountingValleys.py | me1007mea/hacktoberfest2020 | 7d29e18f4486e392ed3d7653536d4883004e1a2b | [
"MIT"
] | 10 | 2020-10-14T15:15:41.000Z | 2020-10-31T17:13:33.000Z | HackerRank/CountingValleys.py | me1007mea/hacktoberfest2020 | 7d29e18f4486e392ed3d7653536d4883004e1a2b | [
"MIT"
] | 91 | 2020-10-13T15:38:28.000Z | 2021-10-02T02:29:55.000Z | import math
import os
import random
import re
import sys
# Complete the countingValleys function below.
def countingValleys(n, s):
valley = 0
level = 0
flag = 0
for i in s:
if (i =="U" and flag == 0):
level+=1
elif(i=="D"):
level-=1
if(level<0):
... | 18.052632 | 47 | 0.48688 | import math
import os
import random
import re
import sys
def countingValleys(n, s):
valley = 0
level = 0
flag = 0
for i in s:
if (i =="U" and flag == 0):
level+=1
elif(i=="D"):
level-=1
if(level<0):
flag=1
elif(i=="U" and flag ... | true | true |
1c319219a636729dc3c8f675b3628b06661c71fe | 368 | py | Python | django/forms/__init__.py | jpmallarino/django | 659d2421c7adbbcd205604002d521d82d6b0b465 | [
"BSD-3-Clause",
"0BSD"
] | 61,676 | 2015-01-01T00:05:13.000Z | 2022-03-31T20:37:54.000Z | checkerista/.env/Lib/site-packages/django/forms/__init__.py | LybaFatimaNasir/CS311S20PID02 | bc29a8c4c9ee508c74d231c015a57b1ca4dfcb39 | [
"MIT"
] | 8,884 | 2015-01-01T00:12:05.000Z | 2022-03-31T19:53:11.000Z | checkerista/.env/Lib/site-packages/django/forms/__init__.py | LybaFatimaNasir/CS311S20PID02 | bc29a8c4c9ee508c74d231c015a57b1ca4dfcb39 | [
"MIT"
] | 33,143 | 2015-01-01T02:04:52.000Z | 2022-03-31T19:42:46.000Z | """
Django validation and HTML form handling.
"""
from django.core.exceptions import ValidationError # NOQA
from django.forms.boundfield import * # NOQA
from django.forms.fields import * # NOQA
from django.forms.forms import * # NOQA
from django.forms.formsets import * # NOQA
from django.forms.models import * # ... | 30.666667 | 58 | 0.75 |
from django.core.exceptions import ValidationError from django.forms.boundfield import * from django.forms.fields import * from django.forms.forms import * from django.forms.formsets import * from django.forms.models import * from django.forms.widgets import * | true | true |
1c31923846bf8a7dea51228bfd3af59166e5308e | 3,351 | py | Python | airflow/contrib/sensors/gcs_sensor.py | jkugiya/airflow | 1dfbb8d2031cb8a3e95e4bf91aa478857c5c3a85 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 3 | 2021-07-30T16:46:46.000Z | 2021-10-19T07:18:47.000Z | airflow/contrib/sensors/gcs_sensor.py | jkugiya/airflow | 1dfbb8d2031cb8a3e95e4bf91aa478857c5c3a85 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 6 | 2019-03-16T02:09:30.000Z | 2019-06-27T03:27:34.000Z | airflow/contrib/sensors/gcs_sensor.py | jkugiya/airflow | 1dfbb8d2031cb8a3e95e4bf91aa478857c5c3a85 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 1 | 2020-10-03T10:59:50.000Z | 2020-10-03T10:59:50.000Z | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 34.193878 | 108 | 0.698001 |
import warnings
from airflow.providers.google.cloud.sensors.gcs import (
GCSObjectExistenceSensor,
GCSObjectsWithPrefixExistenceSensor,
GCSObjectUpdateSensor,
GCSUploadSessionCompleteSensor,
)
warnings.warn(
"This module is deprecated. Please use `airflow.providers.google.cloud.sensors.gcs`.",
... | true | true |
1c3192961af85632a1f3e4f3011c0ea12b0a3ab4 | 2,811 | py | Python | homeassistant/components/velux/cover.py | shanbs/home-assistant | 818776d2b4f11e4f51992dc88bc0a6f9055833b2 | [
"Apache-2.0"
] | 1 | 2019-02-18T03:16:32.000Z | 2019-02-18T03:16:32.000Z | homeassistant/components/velux/cover.py | shanbs/home-assistant | 818776d2b4f11e4f51992dc88bc0a6f9055833b2 | [
"Apache-2.0"
] | 3 | 2021-09-08T03:29:36.000Z | 2022-03-12T00:59:48.000Z | homeassistant/components/velux/cover.py | shanbs/home-assistant | 818776d2b4f11e4f51992dc88bc0a6f9055833b2 | [
"Apache-2.0"
] | 1 | 2019-09-28T07:06:08.000Z | 2019-09-28T07:06:08.000Z | """Support for Velux covers."""
from homeassistant.components.cover import (
ATTR_POSITION, SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION,
SUPPORT_STOP, CoverDevice)
from homeassistant.components.velux import DATA_VELUX
from homeassistant.core import callback
DEPENDENCIES = ['velux']
async def async_setu... | 30.89011 | 73 | 0.652793 | from homeassistant.components.cover import (
ATTR_POSITION, SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION,
SUPPORT_STOP, CoverDevice)
from homeassistant.components.velux import DATA_VELUX
from homeassistant.core import callback
DEPENDENCIES = ['velux']
async def async_setup_platform(
hass, config... | true | true |
1c3192dece33069100e20887af8fa0eccd6f7cd5 | 310 | py | Python | src/main/python/code_style/rules/RuleResult.py | Judge-Girl/Code-Quality-Inspection | 6d0d455fb1c47eba17157a99db5e09fbc61484b8 | [
"Apache-2.0"
] | 1 | 2021-04-22T08:29:03.000Z | 2021-04-22T08:29:03.000Z | src/main/python/code_style/rules/RuleResult.py | Judge-Girl/Code-Quality-Inspection | 6d0d455fb1c47eba17157a99db5e09fbc61484b8 | [
"Apache-2.0"
] | 12 | 2020-11-20T10:05:15.000Z | 2021-01-19T11:10:59.000Z | src/main/python/code_style/rules/RuleResult.py | Judge-Girl/Code-Quality-Inspection | 6d0d455fb1c47eba17157a99db5e09fbc61484b8 | [
"Apache-2.0"
] | null | null | null |
class RuleResult:
def __init__(self, rule_name: str):
self.rule_name = rule_name
def serialize(self):
raise Exception('Abstract method \'serialize\' not implemented')
def collect_from_child(self):
raise Exception('Abstract method \'collect_from_child\' not implemented')
| 28.181818 | 81 | 0.696774 |
class RuleResult:
def __init__(self, rule_name: str):
self.rule_name = rule_name
def serialize(self):
raise Exception('Abstract method \'serialize\' not implemented')
def collect_from_child(self):
raise Exception('Abstract method \'collect_from_child\' not implemented')
| true | true |
1c31940648d4407e8f868d7f5002b96df0b3b0c8 | 260 | py | Python | protocol_controller/plugins/cbsd_sas/validators/grant_request.py | magma/domain-proxy | e6567740e1780d011b0b3ebd366e134d77f434b3 | [
"BSD-3-Clause"
] | null | null | null | protocol_controller/plugins/cbsd_sas/validators/grant_request.py | magma/domain-proxy | e6567740e1780d011b0b3ebd366e134d77f434b3 | [
"BSD-3-Clause"
] | 298 | 2021-03-31T19:29:45.000Z | 2022-03-31T11:30:44.000Z | protocol_controller/plugins/cbsd_sas/validators/grant_request.py | openEPC/domain-proxy | e6567740e1780d011b0b3ebd366e134d77f434b3 | [
"BSD-3-Clause"
] | 5 | 2021-03-31T09:26:37.000Z | 2021-03-31T21:34:16.000Z | from marshmallow import Schema, fields
class GrantRequestObjectSchema(Schema):
cbsdId = fields.String(required=True)
class GrantRequestSchema(Schema):
grantRequest = fields.Nested(GrantRequestObjectSchema, required=True, many=True, unknown='true')
| 26 | 100 | 0.792308 | from marshmallow import Schema, fields
class GrantRequestObjectSchema(Schema):
cbsdId = fields.String(required=True)
class GrantRequestSchema(Schema):
grantRequest = fields.Nested(GrantRequestObjectSchema, required=True, many=True, unknown='true')
| true | true |
1c3194817682c594752efe933b950c482dfc3caf | 1,325 | py | Python | crawlino/modules/sources_module/models.py | BBVA/crawlino | 685f57e6b3e9356484ead2681bb178f651d2f371 | [
"Apache-2.0"
] | 1 | 2018-11-11T21:07:54.000Z | 2018-11-11T21:07:54.000Z | crawlino/modules/sources_module/models.py | BBVA/crawlino | 685f57e6b3e9356484ead2681bb178f651d2f371 | [
"Apache-2.0"
] | null | null | null | crawlino/modules/sources_module/models.py | BBVA/crawlino | 685f57e6b3e9356484ead2681bb178f651d2f371 | [
"Apache-2.0"
] | null | null | null | from typing import Dict
from crawlino.crawlino_flow import STEP_SOURCES
from crawlino.exceptions import CrawlinoValueError
from crawlino.models import CModelBase, CModelBaseLoader
from crawlino.modules_stores import CrawlinoModulesStore
class CMSource(CModelBase, metaclass=CModelBaseLoader):
__slots__ = ("type"... | 29.444444 | 77 | 0.583396 | from typing import Dict
from crawlino.crawlino_flow import STEP_SOURCES
from crawlino.exceptions import CrawlinoValueError
from crawlino.models import CModelBase, CModelBaseLoader
from crawlino.modules_stores import CrawlinoModulesStore
class CMSource(CModelBase, metaclass=CModelBaseLoader):
__slots__ = ("type"... | true | true |
1c3194b6131259ebc1d582358502bae612a4a187 | 43,344 | py | Python | stix2/test/v21/test_granular_markings.py | 2xyo/cti-python-stix2 | cffee92c7ed18c4cdd54c4370c6a17878dfd36cd | [
"BSD-3-Clause"
] | 9 | 2017-07-03T19:01:23.000Z | 2020-02-20T19:22:49.000Z | stix2/test/v21/test_granular_markings.py | 2xyo/cti-python-stix2 | cffee92c7ed18c4cdd54c4370c6a17878dfd36cd | [
"BSD-3-Clause"
] | 1 | 2017-05-30T14:13:27.000Z | 2017-05-30T14:13:27.000Z | stix2/test/v21/test_granular_markings.py | 2xyo/cti-python-stix2 | cffee92c7ed18c4cdd54c4370c6a17878dfd36cd | [
"BSD-3-Clause"
] | 1 | 2017-05-26T19:17:14.000Z | 2017-05-26T19:17:14.000Z | import pytest
from stix2 import markings
from stix2.exceptions import InvalidSelectorError, MarkingNotFoundError
from stix2.v21 import TLP_RED, Malware
from .constants import MALWARE_MORE_KWARGS as MALWARE_KWARGS_CONST
from .constants import MARKING_IDS, MARKING_LANGS
"""Tests for the Data Markings API."""
MALWARE_... | 33.087023 | 137 | 0.535991 | import pytest
from stix2 import markings
from stix2.exceptions import InvalidSelectorError, MarkingNotFoundError
from stix2.v21 import TLP_RED, Malware
from .constants import MALWARE_MORE_KWARGS as MALWARE_KWARGS_CONST
from .constants import MARKING_IDS, MARKING_LANGS
MALWARE_KWARGS = MALWARE_KWARGS_CONST.copy()
... | true | true |
1c3195763ec9140a253961f18bd1ff67f126974a | 1,482 | py | Python | make_mozilla/news/migrations/0002_auto__add_field_article_featured.py | Mozilla-GitHub-Standards/54c69db06ef83bda60e995a6c34ecfd168ca028994e40ce817295415bb409f0c | f80e7c0cff97a1e9b301aa04015db983c7645778 | [
"BSD-3-Clause"
] | 4 | 2015-05-08T16:58:53.000Z | 2019-09-06T05:30:59.000Z | make_mozilla/news/migrations/0002_auto__add_field_article_featured.py | Mozilla-GitHub-Standards/54c69db06ef83bda60e995a6c34ecfd168ca028994e40ce817295415bb409f0c | f80e7c0cff97a1e9b301aa04015db983c7645778 | [
"BSD-3-Clause"
] | 2 | 2019-02-17T17:44:53.000Z | 2019-03-28T03:54:39.000Z | make_mozilla/news/migrations/0002_auto__add_field_article_featured.py | Mozilla-GitHub-Standards/54c69db06ef83bda60e995a6c34ecfd168ca028994e40ce817295415bb409f0c | f80e7c0cff97a1e9b301aa04015db983c7645778 | [
"BSD-3-Clause"
] | 7 | 2015-05-21T15:38:29.000Z | 2019-10-28T23:39:06.000Z | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Article.featured'
db.add_column('news_article', 'featured',
self.gf('d... | 42.342857 | 106 | 0.568826 | import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.add_column('news_article', 'featured',
self.gf('django.db.models.fields.BooleanField')(default=False),
... | true | true |
1c3195d838100a6aa479a48604c5f9b4b8a6f1bd | 1,463 | py | Python | src/app/routes.py | rkruegs123/geo-model-builder | f070afe18ed874b3a31db519ea6f593f40a1be00 | [
"Apache-2.0"
] | 3 | 2020-12-12T10:39:25.000Z | 2021-04-25T14:15:24.000Z | src/app/routes.py | rkruegs123/geo-model-builder | f070afe18ed874b3a31db519ea6f593f40a1be00 | [
"Apache-2.0"
] | null | null | null | src/app/routes.py | rkruegs123/geo-model-builder | f070afe18ed874b3a31db519ea6f593f40a1be00 | [
"Apache-2.0"
] | 2 | 2020-12-12T10:40:12.000Z | 2021-09-15T14:03:39.000Z | """
Copyright (c) 2020 Ryan Krueger. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Ryan Krueger, Jesse Michael Han, Daniel Selsam
"""
from flask import render_template, request, Response, send_file, jsonify
from app import app
from io import StringIO, BytesIO
import ... | 27.092593 | 74 | 0.608339 |
from flask import render_template, request, Response, send_file, jsonify
from app import app
from io import StringIO, BytesIO
import pdb
import base64
from builder import build
from util import DEFAULTS
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html')
@app.route('/solve', m... | true | true |
1c3197e3b1c1e5963a29f43f10b65014e0b840b5 | 1,677 | py | Python | dmd_japan.py | brendanjmeade/dmd_gps | bddc401e7a2e8d0fb44fa830d58197f1319b11c9 | [
"MIT"
] | null | null | null | dmd_japan.py | brendanjmeade/dmd_gps | bddc401e7a2e8d0fb44fa830d58197f1319b11c9 | [
"MIT"
] | null | null | null | dmd_japan.py | brendanjmeade/dmd_gps | bddc401e7a2e8d0fb44fa830d58197f1319b11c9 | [
"MIT"
] | null | null | null | import json
import datetime
import numpy as np
import matplotlib.pyplot as plt
import pydmd as dmd
plt.close("all")
with open('GeonetTimeSeries.json') as json_file:
data = json.load(json_file)
n_stations = len(data)
station_idx = 1
station_data = data[station_idx]
# Loop over all time series and extract star... | 28.913793 | 92 | 0.733453 | import json
import datetime
import numpy as np
import matplotlib.pyplot as plt
import pydmd as dmd
plt.close("all")
with open('GeonetTimeSeries.json') as json_file:
data = json.load(json_file)
n_stations = len(data)
station_idx = 1
station_data = data[station_idx]
all_start_seconds = np.zeros(n_stations)
all... | true | true |
1c3199038a5fdf23ae658d8d6ef10f2a82f2d42f | 27,164 | py | Python | pyiomica/extendedDataFrame.py | benstear/pyiomica | bc26032b610fc911cc03b54115d6abdf53a56fce | [
"MIT"
] | null | null | null | pyiomica/extendedDataFrame.py | benstear/pyiomica | bc26032b610fc911cc03b54115d6abdf53a56fce | [
"MIT"
] | null | null | null | pyiomica/extendedDataFrame.py | benstear/pyiomica | bc26032b610fc911cc03b54115d6abdf53a56fce | [
"MIT"
] | null | null | null | '''PyIOmica Dataframe extending Pandas DataFrame with new functions'''
import sklearn.preprocessing
from .globalVariables import *
from . import utilityFunctions
from . import coreFunctions
class DataFrame(pd.DataFrame):
'''Class based on pandas.DataFrame extending capabilities into the doamin of ... | 33.289216 | 227 | 0.598623 |
import sklearn.preprocessing
from .globalVariables import *
from . import utilityFunctions
from . import coreFunctions
class DataFrame(pd.DataFrame):
def __init__(self, data=None, index=None, columns=None, dtype=None, copy=False):
super().__init__(data=data, index=index, columns=colu... | true | true |
1c319b286435ee2d468ebd6c9e17c0030699f9b7 | 586 | py | Python | nativecap/__init__.py | aisouard/pynativecap | 2d800ff4fee5dbade642d631dfb4c57e9f36d8e7 | [
"MIT"
] | 1 | 2021-01-26T08:58:26.000Z | 2021-01-26T08:58:26.000Z | nativecap/__init__.py | aisouard/nativecap | 2d800ff4fee5dbade642d631dfb4c57e9f36d8e7 | [
"MIT"
] | null | null | null | nativecap/__init__.py | aisouard/nativecap | 2d800ff4fee5dbade642d631dfb4c57e9f36d8e7 | [
"MIT"
] | null | null | null | import ctypes
import glob
import os
import platform
system = platform.system()
extension = ".pyd" if system == "Windows" else ".so"
glob_str = os.path.join(os.path.dirname(
os.path.abspath(__file__)), '..', 'nativecap*{}'.format(extension))
library = ctypes.CDLL(glob.glob(glob_str)[0])
library.nativecap.argtypes ... | 23.44 | 71 | 0.679181 | import ctypes
import glob
import os
import platform
system = platform.system()
extension = ".pyd" if system == "Windows" else ".so"
glob_str = os.path.join(os.path.dirname(
os.path.abspath(__file__)), '..', 'nativecap*{}'.format(extension))
library = ctypes.CDLL(glob.glob(glob_str)[0])
library.nativecap.argtypes ... | true | true |
1c319b2873d919c1cff81621dcdb3a70985ed8c9 | 6,902 | py | Python | cv_lib/classification/models/cifar_large_resnet.py | zhfeing/deep-learning-lib-PyTorch | 1a4e1c1939a42c30fe32dd8d6aff210e8604e77b | [
"MIT"
] | 4 | 2021-03-29T07:34:21.000Z | 2021-04-25T08:25:30.000Z | cv_lib/classification/models/cifar_large_resnet.py | zhfeing/deep-learning-lib | f96e3a71ae2dbeb44696725ec127ff8f37d4c6e9 | [
"MIT"
] | null | null | null | cv_lib/classification/models/cifar_large_resnet.py | zhfeing/deep-learning-lib | f96e3a71ae2dbeb44696725ec127ff8f37d4c6e9 | [
"MIT"
] | 1 | 2021-03-30T07:13:31.000Z | 2021-03-30T07:13:31.000Z | import torch.nn as nn
import torch.nn.functional as F
__all__ = [
"ResNet_CL",
"resnet18_cl",
"resnet34_cl",
"resnet50_cl",
"resnet101_cl",
"resnet152_cl"
]
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, in_planes, planes, stride=1, is_last=False):
... | 35.57732 | 107 | 0.572733 | import torch.nn as nn
import torch.nn.functional as F
__all__ = [
"ResNet_CL",
"resnet18_cl",
"resnet34_cl",
"resnet50_cl",
"resnet101_cl",
"resnet152_cl"
]
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, in_planes, planes, stride=1, is_last=False):
... | true | true |
1c319b288707000dc9d4b775eea4ea744017f477 | 2,287 | py | Python | src/greentest/test___monkey_patching.py | felixonmars/gevent | 400a4099a8c74999afce22e821ba741436085e36 | [
"MIT"
] | 1 | 2019-05-09T08:59:55.000Z | 2019-05-09T08:59:55.000Z | src/greentest/test___monkey_patching.py | felixonmars/gevent | 400a4099a8c74999afce22e821ba741436085e36 | [
"MIT"
] | null | null | null | src/greentest/test___monkey_patching.py | felixonmars/gevent | 400a4099a8c74999afce22e821ba741436085e36 | [
"MIT"
] | null | null | null | import sys
import os
import glob
import util
import atexit
# subprocess: include in subprocess tests
TIMEOUT = 120
directory = '%s.%s' % sys.version_info[:2]
full_directory = '%s.%s.%s' % sys.version_info[:3]
if hasattr(sys, 'pypy_version_info'):
directory += 'pypy'
full_directory += 'pypy'
version = '%s.%s.%... | 32.671429 | 126 | 0.637516 | import sys
import os
import glob
import util
import atexit
TIMEOUT = 120
directory = '%s.%s' % sys.version_info[:2]
full_directory = '%s.%s.%s' % sys.version_info[:3]
if hasattr(sys, 'pypy_version_info'):
directory += 'pypy'
full_directory += 'pypy'
version = '%s.%s.%s' % sys.version_info[:3]
def get_absolu... | true | true |
1c319bb18ca6aa65a963f78ec43ce5b69b69718d | 963 | py | Python | o3seespy/command/analysis.py | vijaypolimeru/o3seespy | c9ef0c27f685de705721b10eb1ea81c3a3c24c4e | [
"MIT",
"BSD-3-Clause"
] | null | null | null | o3seespy/command/analysis.py | vijaypolimeru/o3seespy | c9ef0c27f685de705721b10eb1ea81c3a3c24c4e | [
"MIT",
"BSD-3-Clause"
] | 1 | 2021-06-25T15:33:31.000Z | 2021-06-25T15:33:31.000Z | o3seespy/command/analysis.py | millen1m/o3seespy | 7eead6aef8055f73af39b969e0d3499a67e1737f | [
"MIT",
"BSD-3-Clause"
] | 1 | 2020-12-12T21:01:42.000Z | 2020-12-12T21:01:42.000Z | from o3seespy.base_model import OpenSeesObject
class AnalysisBase(OpenSeesObject):
op_base_type = "analysis"
class Static(AnalysisBase):
op_type = "Static"
def __init__(self, osi):
self._parameters = [self.op_type]
self.to_process(osi)
class Transient(AnalysisBase):
op_type = "Tr... | 20.934783 | 93 | 0.659398 | from o3seespy.base_model import OpenSeesObject
class AnalysisBase(OpenSeesObject):
op_base_type = "analysis"
class Static(AnalysisBase):
op_type = "Static"
def __init__(self, osi):
self._parameters = [self.op_type]
self.to_process(osi)
class Transient(AnalysisBase):
op_type = "Tr... | true | true |
1c319bc32424b49951dda5aa20749cbeca82648c | 15,230 | py | Python | test/functional/docker/test_scenarios.py | LANsible/molecule | c259ef0e920ac12b4e47e60af4e6a33944c41f0b | [
"MIT"
] | 1 | 2019-06-03T01:53:47.000Z | 2019-06-03T01:53:47.000Z | test/functional/docker/test_scenarios.py | LANsible/molecule | c259ef0e920ac12b4e47e60af4e6a33944c41f0b | [
"MIT"
] | 1 | 2018-12-22T09:39:30.000Z | 2018-12-22T09:39:30.000Z | test/functional/docker/test_scenarios.py | LANsible/molecule | c259ef0e920ac12b4e47e60af4e6a33944c41f0b | [
"MIT"
] | 1 | 2019-01-31T20:55:33.000Z | 2019-01-31T20:55:33.000Z | # Copyright (c) 2015-2018 Cisco Systems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge... | 29.688109 | 79 | 0.64872 |
import os
import re
import pytest
import sh
import shutil
from molecule import util
from ..conftest import (
change_dir_to,
needs_inspec,
needs_rubocop,
skip_unsupported_matrix,
)
@pytest.fixture
def scenario_to_test(request):
return request.param
@pytest.fixture
def scenario_name(request):
... | true | true |
1c319bffd032ab13cd239f57cf3f5a0f434956ba | 784 | py | Python | utils/get_api.py | guillermo-carrasco/tweestream | 5171b8fae27a13395eb38ed90031cf6caf6d444e | [
"MIT"
] | null | null | null | utils/get_api.py | guillermo-carrasco/tweestream | 5171b8fae27a13395eb38ed90031cf6caf6d444e | [
"MIT"
] | 6 | 2018-03-29T14:14:53.000Z | 2020-10-23T09:57:12.000Z | utils/get_api.py | guillermo-carrasco/twistream | 5171b8fae27a13395eb38ed90031cf6caf6d444e | [
"MIT"
] | null | null | null | """
Simple method to quickly get an API object, already authenticated, to work with interactively. It expects a config.yaml
file in the same directory where it is ran. This yaml file should contain twitter application credentials in the same
format expected by twistream. In fact, you can very well use the same configur... | 35.636364 | 119 | 0.714286 | import yaml
from tweepy import API
from twistream.twitter import client
def get_api() -> API:
with open("config.yaml", "r") as f:
config = yaml.load(f, Loader=yaml.FlowMappingEndToken)
return client.get_api(
config.get("twitter").get("consumer_key"),
config.get("twitter").get("consum... | true | true |
1c319d63f6f6de62c8bef71b24da7d04b6142551 | 142 | py | Python | examples/select_chat_by_number.py | YohananDiamond/whatsappy | 2474839baf32295fea568c4dd30c59edace11e58 | [
"MIT"
] | null | null | null | examples/select_chat_by_number.py | YohananDiamond/whatsappy | 2474839baf32295fea568c4dd30c59edace11e58 | [
"MIT"
] | null | null | null | examples/select_chat_by_number.py | YohananDiamond/whatsappy | 2474839baf32295fea568c4dd30c59edace11e58 | [
"MIT"
] | null | null | null | from whatsappy import whatsapp
whatsapp.login()
whatsapp.select_chat_by_number(14078888888) # <--
whatsapp.send("Hello")
whatsapp.close()
| 15.777778 | 50 | 0.774648 | from whatsappy import whatsapp
whatsapp.login()
whatsapp.select_chat_by_number(14078888888) whatsapp.send("Hello")
whatsapp.close()
| true | true |
1c319dff802e65ab8ad36d6d7405dd863634b7df | 2,999 | py | Python | Chapter09/chh9-1.nltk.py | tschoi6712/pythonDataAnalysis2nd | 63e366d4dee52f7e4df6cf4d988a85d6de5b00e4 | [
"MIT"
] | null | null | null | Chapter09/chh9-1.nltk.py | tschoi6712/pythonDataAnalysis2nd | 63e366d4dee52f7e4df6cf4d988a85d6de5b00e4 | [
"MIT"
] | null | null | null | Chapter09/chh9-1.nltk.py | tschoi6712/pythonDataAnalysis2nd | 63e366d4dee52f7e4df6cf4d988a85d6de5b00e4 | [
"MIT"
] | null | null | null | """
문자 데이터와 소셜미디어 분석하기(1)
"""
# pip install nltk scikit-learn
# >python
# >>>import nltk
# >>>nltk.download()
## 1. Filtering out stopwords, names, and numbers(불용어, 고유명사, 숫자 걸러내기)
import nltk
# 영어 말뭉치를 불러오기
sw = set(nltk.corpus.stopwords.words('english'))
print("Stop words:", list(sw)[:7])
# 구텐베르크 말뭉치 불러오기
gb = nlt... | 22.89313 | 93 | 0.692564 |
import nltk
sw = set(nltk.corpus.stopwords.words('english'))
print("Stop words:", list(sw)[:7])
gb = nltk.corpus.gutenberg
print("Gutenberg files:\n", gb.fileids()[-5:])
text_sent = gb.sents("milton-paradise.txt")[:2]
print("Unfiltered:", text_sent)
for sent in text_sent:
filtered = [w for w in sent if w.lowe... | true | true |
1c319e88e8a6163f1d250717cf2460bdb0893a46 | 37,716 | py | Python | tests/test_generators/output/kitchen_sink.py | joseporiolayats/linkml | 1d0a736079847764c6a78349dcc8838839009b74 | [
"CC0-1.0"
] | null | null | null | tests/test_generators/output/kitchen_sink.py | joseporiolayats/linkml | 1d0a736079847764c6a78349dcc8838839009b74 | [
"CC0-1.0"
] | null | null | null | tests/test_generators/output/kitchen_sink.py | joseporiolayats/linkml | 1d0a736079847764c6a78349dcc8838839009b74 | [
"CC0-1.0"
] | null | null | null | # Auto generated from kitchen_sink.yaml by pythongen.py version: 0.9.0
# Generation date: 2021-11-13T01:57:24
# Schema: kitchen_sink
#
# id: https://w3id.org/linkml/tests/kitchen_sink
# description: Kitchen Sink Schema This schema does not do anything useful. It exists to test all features of
# linkml. Thi... | 41.813747 | 178 | 0.697821 |
import dataclasses
import sys
import re
from jsonasobj2 import JsonObj, as_dict
from typing import Optional, List, Union, Dict, ClassVar, Any
from dataclasses import dataclass
from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions
from linkml_runtime.utils.slot import Slot
fro... | true | true |
1c319f1a9bda9948051b92df81c9a19df60a9bfe | 83,806 | py | Python | test/distributed/test_c10d_gloo.py | photoszzt/pytorch | 179249084b66b8fbacbd95d39b7cbce0cd9eb972 | [
"Intel"
] | 1 | 2021-07-18T18:58:07.000Z | 2021-07-18T18:58:07.000Z | test/distributed/test_c10d_gloo.py | JINAY08/pytorch | f2857883c4c148ced4f920431b38532fe8081b73 | [
"Intel"
] | null | null | null | test/distributed/test_c10d_gloo.py | JINAY08/pytorch | f2857883c4c148ced4f920431b38532fe8081b73 | [
"Intel"
] | null | null | null | import copy
import logging
import math
import operator
import os
import random
import sys
import tempfile
import unittest
from functools import reduce
from itertools import groupby
import torch
import torch.distributed as c10d
if not c10d.is_available():
print("c10d not available, skipping tests", file=sys.stderr... | 38.513787 | 128 | 0.608238 | import copy
import logging
import math
import operator
import os
import random
import sys
import tempfile
import unittest
from functools import reduce
from itertools import groupby
import torch
import torch.distributed as c10d
if not c10d.is_available():
print("c10d not available, skipping tests", file=sys.stderr... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.