id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8133430 | <filename>questions/n-queens-ii/Solution.py
"""
The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.
Given an integer n, return the number of distinct solutions to the n-queens puzzle.
Example 1:
Input: n = 4
Output: 2
Explanation: There are two d... | StarcoderdataPython |
8070834 | from datetime import timezone
from enum import unique
from . import db
from flask_login import UserMixin
from sqlalchemy.sql import func
class Note(db.Model):
id = db.Column(db.Integer, primary_key = True)
text = db.Column(db.String(4096))
date = db.Column(db.DateTime(timezone = True), default = f... | StarcoderdataPython |
303906 | #
# bgNukes.py
#
# v1.3
#
# <NAME> [<EMAIL>]
#
# A script for launching single-core command-line Nuke renderers
# in the background from inside the Nuke UI.
#
# Saves log files of each render instance's output to the same folder
# where the Nuke script lives.
#
# Thanks go to <NAME>. His localRender.py was (and cont... | StarcoderdataPython |
3505893 | <gh_stars>0
""" vault encrypt lambda """
from __future__ import print_function
import logging
import json
import boto3
from botocore.exceptions import ClientError
from botocore.vendored import requests
import ansible
from ansible.parsing.vault import VaultLib
from ansible.constants import DEFAULT_VAULT_ID_MATCH
from an... | StarcoderdataPython |
300225 | import os
import argparse
import pandas as pd
ROLLUPS_DIR = 'rollups'
def get_eta(origin, dest):
# NOTE: This only works for nodes which are adjacent; in order for full route eta, we
# would need to either (1) pass in route plan or (2) do to-ultimate-destination calculations
latest_rollup = sorted(os.list... | StarcoderdataPython |
4837464 | import argparse
import sys
import time
import numpy as np
import pyqtgraph as pg
from sensapex import UMP
from sensapex.sensapex import LIBUM_DEF_BCAST_ADDRESS
from sensapex.utils import bytes_str
parser = argparse.ArgumentParser(
description="Test for sensapex devices; perform a series of random moves while rap... | StarcoderdataPython |
3446817 | <reponame>Darkhunter9/python
from math import ceil, floor
import re
def text_formatting(text: str, width: int, style: str) -> str:
words = text.split(' ')
lines = []
line = ''
while words:
while words and (len(line) <= width - len(words[0]) - 1 or not line):
if not line:
... | StarcoderdataPython |
1896324 | <reponame>davidxiao93/Advent-of-Code
input = """+11
+14
+10
-8
-13
-2
+8
+14
-11
-4
+2
-17
-15
-12
-15
-16
-15
-13
-15
-4
-9
-4
-9
-12
+19
+1
+10
+15
-6
+15
+15
+19
-8
+16
+2
+12
+10
+20
-15
+16
-3
-2
+1
+8
+5
-6
+8
-22
-14
+13
-12
-6
+11
-1
+21
+11
+4
-6
-19
-27
-14
+8
-5
+1
-6
-16
-10
+13
-14
-4
-9
-5
+17
-4
-17
+2
+... | StarcoderdataPython |
1993133 | <reponame>LucasHelal/data-science
import numpy as np
# Create an array
arr = np.arange(5)
# Saving array on disk in binary format (file extension .npy)
np.save('my_array', arr)
# Change arr
arr = np.arange(10)
# Lets see the original saved copy
np.load('my_array.npy')
# Saving multiple arrays into a zip file
np.sa... | StarcoderdataPython |
8145453 | from setuptools import setup, find_packages
import codecs
import os
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
long_description = "\n" + fh.read()
VERSION = '1.0.6'
DESCRIPTION = 'Python Chemical Thermodynamics for Process Modeling... | StarcoderdataPython |
8006904 | <gh_stars>100-1000
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from typing import cast
from datadog_checks.base import OpenMetricsBaseCheck
from .config import Config
from .types import Instance
class AzureIoTEdgeCheck(OpenMetricsBaseCheck):
... | StarcoderdataPython |
352492 | <reponame>pwessels-uhh/sarkas<filename>sarkas/time_evolution/integrators.py
"""
Module of various types of time_evolution
"""
import numpy as np
from numba import njit
from IPython import get_ipython
if get_ipython().__class__.__name__ == 'ZMQInteractiveShell':
from tqdm import tqdm_notebook as tqdm
else:
fro... | StarcoderdataPython |
1633707 | """Platform for Miele button integration."""
from __future__ import annotations
import logging
from dataclasses import dataclass
from typing import Any, Final
import aiohttp
from homeassistant.components.button import ButtonEntity, ButtonEntityDescription
from homeassistant.core import HomeAssistant
from homeassistan... | StarcoderdataPython |
9677909 | #!/usr/bin/env python3
# <NAME>
# based off of Tdulcet's 'mprime.exp'
# Python3 exp.py <User ID> <Computer name> <Type of work>
# Note: * pexpect has quirks about nonempty ()s (e.g., (y)), *s, inline ''s, or +s.
import sys
from time import sleep
import subprocess
# Potentially installing dependency
try:
import ... | StarcoderdataPython |
4882661 | <filename>LeetCode-All-Solution/Python3/LC-0784-Letter-Case-Permutation.py<gh_stars>0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""=================================================================
@Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3
@File : LC-0784-Letter-Case-Permutation.py
@Author : [Yu... | StarcoderdataPython |
1762758 | <gh_stars>1-10
#!/usr/bin/env python
import math
import numpy as np
from tqdm import tqdm
import seaborn as sns
import pandas as pd
from subprocess import call
import matplotlib.pyplot as plt
from pushestpy.utils import utils
plt.rcParams.update({'font.size': 36})
def wrap_to_pi(arr):
arr_wrap = (arr + math.... | StarcoderdataPython |
322308 | DEPS = [
'archive',
'depot_tools/bot_update',
'chromium',
'chromium_tests',
'chromium_android',
'commit_position',
'file',
'depot_tools/gclient',
'isolate',
'recipe_engine/path',
'recipe_engine/platform',
'recipe_engine/properties',
'recipe_engine/python',
'recipe_engine/step',
'swarming',... | StarcoderdataPython |
6459393 | from django.conf import settings
from django.contrib import messages
from django.core.mail import send_mail, mail_admins
from django.urls import reverse
from django.utils import timezone
from .models import *
| StarcoderdataPython |
62634 | #!/usr/bin/python -B
# 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
# "Lic... | StarcoderdataPython |
9721598 | """Setup package"""
import os
import re
import subprocess
import sys
from setuptools import setup, find_packages
from setuptools.command.build_ext import build_ext as _build_ext
# Packages to include in the distribution
packages = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"])
# Additional data ... | StarcoderdataPython |
8199700 | # Generated by Django 3.2.2 on 2021-07-20 06:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('shop', '0021_product_label'),
]
operations = [
migrations.RemoveField(
model_name='product',
name='label',
),
]
| StarcoderdataPython |
3593268 | """
Functionality for getting and plotting SDSS image data.
"""
__all__=['sdss']
| StarcoderdataPython |
188749 | def django_ready(context):
context.django = True | StarcoderdataPython |
4901832 | import mmcv
import pytest
def test_iter_cast():
assert mmcv.list_cast([1, 2, 3], int) == [1, 2, 3]
assert mmcv.list_cast(['1.1', 2, '3'], float) == [1.1, 2.0, 3.0]
assert mmcv.list_cast([1, 2, 3], str) == ['1', '2', '3']
assert mmcv.tuple_cast((1, 2, 3), str) == ('1', '2', '3')
assert next(mmcv.it... | StarcoderdataPython |
5072869 | <reponame>simonzsy/facedetector
import dlib
import os
_face_model = dlib.face_recognition_model_v1(
os.path.join(os.path.join(os.path.dirname(__file__), "data"), "dlib_face_recognition_resnet_model_v1.dat"))
def describe(image, shape):
return _face_model.compute_face_descriptor(image, shape)
| StarcoderdataPython |
103024 | """
百度分类API:
pip install baidu-aip
"""
import time
import os
import sys
import codecs
import json
import traceback
from tqdm import tqdm
from aip import AipNlp
sys.path.insert(0, './') # 定义搜索路径的优先顺序,序号从0开始,表示最大优先级
from data import baidu_config # noqa
""" 你的 APPID AK SK """
APP_ID = baidu_config.APP_ID # '你的 App ID... | StarcoderdataPython |
9611590 | <gh_stars>0
from . import StorageEngineInterface
GLUE = "."
class DictionaryEngine(StorageEngineInterface):
def __init__(self):
self.data = {}
def set(self, key, value):
keys = key.split(GLUE)
tmp = self.data
for k in keys:
if k == keys[-1]:
tmp.up... | StarcoderdataPython |
4882633 | N = int(input())
K = int(input())
result = 1
for i in range(N):
if result <= K:
result = 2*result
else:
result += K
print(result)
| StarcoderdataPython |
4886787 | <reponame>aloctavodia/kulprit
"""Continuous distribution families."""
from kulprit.data.data import ModelData
from kulprit.data.submodel import SubModelStructure
from kulprit.families import BaseFamily
import numpy as np
import torch
class GaussianFamily(BaseFamily):
def __init__(self, data: ModelData) -> None:... | StarcoderdataPython |
8124465 | <gh_stars>0
from rest_framework import serializers
from .models import Account
class AccountSerializer(serializers.ModelSerializer):
url=serializers.CharField(source='get_absolute_url',read_only=True)
class Meta:
model = Account
fields = ['id', 'name', 'url_link', 'username', 'password', 'crea... | StarcoderdataPython |
5049626 | from random import randint
print("""As opções são:
1 - Tesoura
2 - Pedra
3 - Papel\n""")
es = int(input("Digite sua escolha: "))
esc = randint(1, 3)
print("JO")
print("KEN")
print("PO")
if esc == 1:
mostrar = "Tesoura"
elif esc == 2:
mostrar = "Pedra"
elif esc == 3:
mostra... | StarcoderdataPython |
1851452 | '''Pusher environment.'''
import os
from gym.envs.mujoco import mujoco_env
import numpy as np
class PusherEnv(mujoco_env.MujocoEnv):
'''PusherEnv.'''
GOAL_ZERO_POS = [0.45, -0.05, -0.3230] # from xml
OBJ_ZERO_POS = [0.45, -0.05, -0.275] # from xml
def __init__(self, task='forward'):
self._... | StarcoderdataPython |
12829711 | <reponame>FGtatsuro/myatcoder
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(input())
ans = 0
for i in range(1, n+1):
j = n // i
ans += (j * (j+1) * i) // 2
print(ans)
| StarcoderdataPython |
9712059 | <reponame>cloudblue/product-sync
import click
import pytest
from connect.cli.plugins.translation.activate import activate_translation
def test_activate_translation(
mocked_responses,
mocked_translation_response,
):
mocked_responses.add(
method='POST',
url='https://localhost/public/v1/loca... | StarcoderdataPython |
8053546 | <reponame>MinisterioPublicoRJ/api-cadg<filename>dominio/tests/test_dao.py<gh_stars>1-10
from unittest import mock
import pytest
from rest_framework import serializers
from django.conf import settings
from dominio.exceptions import APIEmptyResultError
from dominio.dao import (
GenericDAO,
SingleDataObjectDAO,
... | StarcoderdataPython |
301181 | <reponame>landdafku11/cryptocurrencybot<gh_stars>1-10
import re
result = re.match(r'Analytics', 'AV Analytics ESET AV')
ad | StarcoderdataPython |
5195223 | # encoding: utf-8
from ..handlers import BaseRequestHandler
import setting
from worker import REQUESTS_PER_MINUTE, LOCAL_OBJECT_DURATION, BROADCAST_ACTIVE_DURATION, BROADCAST_INCREMENTAL_BACKUP, IMAGE_LOCAL_CACHE
class General(BaseRequestHandler):
"""
设置
"""
def get(self, flash=''):
requests_... | StarcoderdataPython |
3300374 | #!/usr/bin/env python
import os.path
import logging
import uuid
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.escape
import tornado.web
from tornado.escape import json_encode
from tornado.options import define, options
define("port", default=8080, help="run on the given port",... | StarcoderdataPython |
1800486 | <reponame>Mishrasubha/napari
import numpy as np
import numpy.testing as npt
import pytest
from scipy.stats import special_ortho_group
from napari.utils.transforms import Affine, CompositeAffine, ScaleTranslate
transform_types = [Affine, CompositeAffine, ScaleTranslate]
@pytest.mark.parametrize('Transform', transfor... | StarcoderdataPython |
9654074 | import string
import random
def unique_strings(k: int, ntokens: int,
pool: str = string.ascii_letters) -> set:
'creeza un string unic'
seen = set()
join = ''.join
add = seen.add
while len(seen) < ntokens:
token = join(random.choices(pool, k=k))
add(token)
r... | StarcoderdataPython |
1642679 | from distutils.core import setup
setup(
name='momap',
version='0.01.c',
packages=['momap'],
install_requires=['sortedcontainers'],
platforms='any',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
url='https://github.com/Endle/momap',
description='Multi Ordered Map for... | StarcoderdataPython |
5013351 | <reponame>FHU-yezi/JianshuAvailabilityMonitor
from peewee import (BooleanField, CharField, DateTimeField, IntegerField,
Model, SqliteDatabase)
class RunLog(Model):
id = IntegerField(primary_key=True)
time = DateTimeField()
level = IntegerField()
message = CharField()
class Met... | StarcoderdataPython |
3325669 | <gh_stars>0
# Get data from comprehend.rightcall and from dynamodb database,
# combine it and load it into elasticsearch
import elasticsearch_tools
import s3 as s3py
import logging
import boto3
import dynamodb_tools
from requests_aws4auth import AWS4Auth
LOGLEVEL = 'DEBUG'
# Logging
levels = ['DEBUG', 'INFO', 'WARNIN... | StarcoderdataPython |
374454 | <filename>arxiv_html/renders/tests/test_integration.py
import time
import os
from django.conf import settings
from django.test import override_settings
from rest_framework.test import APITestCase
import timeout_decorator
@override_settings(
ARXIV_SOURCE_URL_FORMAT="/code/arxiv_html/renders/tests/fixtures/{source... | StarcoderdataPython |
5156920 | from flask_restplus import Namespace, Resource, fields
from werkzeug.datastructures import FileStorage
from flask import make_response
from PIL import Image
import io
import glob
import os
import shutil
from flask import abort
from config import MODEL_META_DATA
from core.backend import ModelWrapper
from api.pre_process... | StarcoderdataPython |
6462604 | <reponame>faribas/RMG-Py<filename>external/cclib/bridge/__init__.py
"""
cclib (http://cclib.sf.net) is (c) 2006, the cclib development team
and licensed under the LGPL (http://www.gnu.org/copyleft/lgpl.html).
"""
__revision__ = "$Revision: 839 $"
try:
import openbabel
except Exception:
pass
else:
from ccl... | StarcoderdataPython |
1683809 | <filename>modules/templates/CERT/controllers.py
# -*- coding: utf-8 -*-
from os import path
try:
import json # try stdlib (Python 2.6)
except ImportError:
try:
import simplejson as json # try external module
except:
import gluon.contrib.simplejson as json # fallback to pure-Python module
... | StarcoderdataPython |
9609252 | """ Contains SQL Dialects """
def dialect_selector(s):
lookup = {
'ansi': AnsiSQLDialiect
}
return lookup[s]
class AnsiSQLDialiect(object):
name = 'ansi'
# Whitespace is what divides other bits of syntax
# # whitespace_regex = RegexMatchPattern(r'\s+', 'whitespace')
# Anything af... | StarcoderdataPython |
327603 | <gh_stars>10-100
"""Test kytos.core.connection module."""
from socket import error as SocketError
from unittest import TestCase
from unittest.mock import MagicMock
from kytos.core.connection import Connection, ConnectionState
class TestConnection(TestCase):
"""Connection tests."""
def setUp(self):
"... | StarcoderdataPython |
9751630 | # -*- coding: UTF-8 -*-
"""
Copyright 2020 Tianshu AI Platform. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless req... | StarcoderdataPython |
6565044 | <gh_stars>0
import setuptools
with open("README.md", "r") as f:
long_description = f.read()
setuptools.setup(
name='erg',
version='0.0.1',
author='<NAME>',
author_email='<EMAIL>',
description='Package for unpacking erg data.',
long_description=long_description,
long_description_content... | StarcoderdataPython |
5015947 | <reponame>keeplerteam/thekpi
from network.ipfs import Ipfs
MOCK_SERVER_VERSION = {"Version": "0.9.1", "Commit": "", "Repo": "11", "System": "amd64/windows", "Golang": "go1.16.6"}
PUT_BLOCK_RESPONSE = {'Key': '<KEY>', 'Size': 14}
GET_BLOCK_RESPONSE = {"test": True}
def test_load_version():
node = Ipfs()
asser... | StarcoderdataPython |
3328102 | <filename>packaging/setup/plugins/ovirt-engine-remove/base/files/simple.py<gh_stars>1-10
#
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2013-2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may o... | StarcoderdataPython |
8114709 | <reponame>fekblom/critic<filename>testing/tests/001-main/004-extensions/002-tests/004-TestExtension/008-processcommits.py
import os
import re
def to(name):
return testing.mailbox.ToRecipient("<EMAIL>" % name)
def about(subject):
return testing.mailbox.WithSubject(subject)
FILENAME = "008-processcommits.txt"
... | StarcoderdataPython |
6614285 | import os
from vgazer.command import RunCommand
from vgazer.config.cmake import ConfigCmake
from vgazer.exceptions import CommandError
from vgazer.exceptions import InstallError
from vgazer.platform import GetArFullPath
from vgazer.platform import GetCc
from vgazer.platform im... | StarcoderdataPython |
3494375 | import pytest
from mappgene import cli
def test_vpipe():
assert True | StarcoderdataPython |
1946340 | <filename>altgraph_tests/test_graph.py
import unittest
from altgraph import GraphError
from altgraph.Graph import Graph
class TestGraph(unittest.TestCase):
def test_nodes(self):
graph = Graph()
self.assertEqual(graph.node_list(), [])
o1 = object()
o1b = object()
o2 = obj... | StarcoderdataPython |
4917609 | ''' probables utilitites tests '''
from __future__ import (unicode_literals, absolute_import, print_function)
import unittest
import os
from probables.utilities import (is_hex_string, is_valid_file, get_x_bits)
from . utilities import (different_hash)
class TestProbablesUtilities(unittest.TestCase):
''' test the... | StarcoderdataPython |
9783131 | <reponame>Thanaporn09/Cancer_self_transformer
# Copyright (c) OpenMMLab. All rights reserved.
import math
from collections import OrderedDict
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import build_activation_layer
from mmcv.cnn.utils.weight_init import trunc_normal_
from mmcv.runner import Se... | StarcoderdataPython |
6490707 | <filename>testdata/simple.py<gh_stars>100-1000
from foo import bar
def f(self, a, b):
print('hello!')
| StarcoderdataPython |
37284 | <reponame>wangyibin/biowy
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time: 2019/1/8 16:41
from bioway.apps.base import dmain
if __name__ == "__main__":
dmain() | StarcoderdataPython |
3500323 | """Linked List Cycle II
https://www.lintcode.com/problem/linked-list-cycle-ii/description
"""
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: The first node of linked list.
@retu... | StarcoderdataPython |
212831 | #!/usr/bin/env python
# vim:ts=4:sts=4:sw=4:et
#
# Author: <NAME>
# Date: 2016-09-29 15:00:36 +0100 (Thu, 29 Sep 2016)
#
# https://github.com/harisekhon/devops-python-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn
# and optio... | StarcoderdataPython |
4836388 | <gh_stars>0
""" A Queue using a linked list like structure """
from typing import Any
class Node:
def __init__(self, data: Any) -> None:
self.data = data
self.next = None
def __str__(self) -> str:
return f"{self.data}"
class LinkedQueue:
"""
>>> queue = Linked... | StarcoderdataPython |
6619564 | # -*- coding: utf-8 -*-
# Settings for running the test application testcases
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import... | StarcoderdataPython |
4904070 | <reponame>Nyrio/beat-saber-mapping-scripts<gh_stars>10-100
import json
import imageio
import numpy as np
FILES = ["ExpertStandard.dat"]
def fix_time(t):
"""The change of BPM causes a mess with Noodle Extensions...
"""
return t if t < 320 else 320 + 122 * (t - 320) / 136
def load_fonts(lyrics_json):
... | StarcoderdataPython |
285437 | from django.db import models
from chemreg.lists.models import List, Record
from chemreg.lists.utils import build_rid
from chemreg.substance.models import Substance
def test_record():
"""Tests the validity of the Record Model's attributes"""
# Primitives
assert type(Record.id.field) is models.CharField
... | StarcoderdataPython |
1944459 | <filename>test/test_cherrypy.py
# -*- coding: utf-8 -*-
import os
import socket
import time
import unittest
from mock import MagicMock, call
import cherrypy
from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
from ws4py.websocket import EchoWebSocket
from ws4py.framing import Frame, OPCODE_TEXT, OP... | StarcoderdataPython |
11382746 | # this the interface to create your own data source
# this class pings a private / public blockchain to get the balance and code information
from web3 import Web3, KeepAliveRPCProvider
class EthereumData:
def __init__(self):
self.host = 'x.x.x.x'
self.port = '8545'
self.web3 = Web3(KeepAliveRPCProvider(host=... | StarcoderdataPython |
1912043 | import linecache
from threading import Thread
import sys
from logging import Handler, Formatter
from logging import CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET
import time
try:
from Queue import Queue
except:
from queue import Queue
import requests
import json
_levelToName = {
CRITICAL: 'FATAL',
ERR... | StarcoderdataPython |
6687051 | """
cpymadtools package
~~~~~~~~~~~~~~~~~~~
cpymadtools is a collection of utilities that integrate within my workflow with the `cpymad` library.
:copyright: (c) 2019 by <NAME>.
:license: MIT, see LICENSE for more details.
"""
from .errors import misalign_lhc_ir_quadrupoles, misalign_lhc_triplets, switch_magnetic_err... | StarcoderdataPython |
6468671 | <gh_stars>0
from urllib import error as error
import json
import requests
from ansible.module_utils.basic import AnsibleModule
def __api_call(module):
base_url=module.params.get('url')
data=module.params.get('data')
access_token=module.params.get('access_token')
url = str(base_url)
... | StarcoderdataPython |
9777866 | <reponame>qtson/pyjanitor
from .functions import * # noqa: F403, F401
# from .dataframe import JanitorDataFrame as DataFrame # noqa: F401
# from .dataframe import JanitorSeries as Series # noqa: F401
__version__ = "0.17.2"
| StarcoderdataPython |
1644470 | <reponame>ranok92/deepirl
import numpy as np
from numba import njit
import pdb
def angle_between(v1, v2):
v1_conv = v1.astype(np.dtype('float'))
v2_conv = v2.astype(np.dtype('float'))
return np.abs(np.arctan2(np.linalg.det(np.stack((v1_conv,v2_conv))), np.dot(v1_conv,v2_conv)))
@njit
def unit_vector(vec... | StarcoderdataPython |
1799150 | <reponame>AvirityInformation/chatbot_Jullie
from enum import Enum
class Payload(Enum):
MESSAGE_WITHOUT_BUTTON_IN_INTRO = 'MESSAGE_WITHOUT_BUTTON_IN_INTRO_PAYLOAD'
SUICIDAL_THOUGHT_DURING_CONVERSATION = 'SUICIDAL_THOUGHT_DURING_CONVERSATION_PAYLOAD'
GREETING = 'GREETING'
CCT_1 = "CCT_1"
CCT_2 = "... | StarcoderdataPython |
6706230 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import subprocess
import shlex
import pandas as pd
import numpy as np
from astropy.table import Table
from astropy.table import Column
import os
import glob2
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import SNID_Analysis
import... | StarcoderdataPython |
3519247 | from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden
from django.views.decorators.csrf import csrf_exempt
from linebot import LineBotApi, WebhookParser
from linebot.exceptions import InvalidSignatureError, LineBotApiError
from linebot.models import Messag... | StarcoderdataPython |
6410157 | <filename>profiles/migrations/0019_auto_20180514_2128.py
# Generated by Django 2.0.3 on 2018-05-14 21:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profiles', '0018_auto_20180514_2106'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
1644831 | """Computation of the dissimilarity representation of a set of objects
(streamlines) from a set of prototypes (streamlines) given a distance
function. Some prototype selection algorithms are available.
See <NAME>., <NAME>., <NAME>., The Approximation of
the Dissimilarity Projection, http://dx.doi.org/10.1109/PRNI.2012... | StarcoderdataPython |
5031830 | import time
import os
from multiprocessing import Process, Queue
from cache import set_cache, string_cache, set_global_root
from Queue import Empty
import secondary_functions
from json_socket import make_socket, send_json, get_socket
session = {}
socket = None
procs = None
def main():
init_thread... | StarcoderdataPython |
3552386 | # Copyright (c) WFDetection, Inc. and its affiliates. All Rights Reserved
import logging
import numpy as np
import torch
from torch import nn
from cvpods.layers import (
Conv1d,
DeformConv,
FrozenBatchNorm2d,
ModulatedDeformConv,
ShapeSpec,
get_activation,
get_norm
)
from cvpods.modeling.... | StarcoderdataPython |
3292950 | <filename>bitbot/services/__init__.py<gh_stars>0
from .service import ServiceInterface, Order, OrderDirection, OrderType, CandleInterval, TimeInForce, now_milliseconds, date_time_milliseconds, printProgressBar
from .bittrex import BitTrex | StarcoderdataPython |
216489 | <gh_stars>1-10
import sample_simulations.basic_sim
if __name__ == "__main__":
sample_simulations.basic_sim | StarcoderdataPython |
5033401 | <filename>data_structures/sorting_algos/mergesort/test_mergesort.py
import pytest
from mergesort import mergesort, merge
def test_empty_list_returns_empty_list():
"""Test mergesort on empty list returns same."""
empty = []
assert mergesort(empty) == []
def test_list_with_one_value():
"""Test mergeso... | StarcoderdataPython |
3450344 | <filename>BunqWebApp/urls.py
"""MoneyWebApp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', ... | StarcoderdataPython |
4867341 | <reponame>timvideos/slidelint_site
import unittest
from pyramid import testing
from testfixtures import compare
class CounterModelTests(unittest.TestCase):
def test_constructor(self):
from slidelint_site.models import Counter
instance = Counter()
compare(instance.count, 0)
rez = i... | StarcoderdataPython |
230800 | <gh_stars>0
import markdown as markdown_library
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def markdown(value):
"""
Translate markdown to a safe subset of HTML.
"""
md_text = markdown_library.markdown(value)
return mark... | StarcoderdataPython |
3350190 | <reponame>bbrighttaer/DCCA_demo<filename>objective.py
# Author: bbsipingsoft
# Project: DCCA_demo
# Date: 4/24/19
# Time: 1:16 PM
# File: objective.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
de... | StarcoderdataPython |
5034854 | <reponame>comscope/comsuite<gh_stars>10-100
import os
import glob
import warnings
def get_wiencase():
# Determine WIEN2k case name
case = os.path.basename(os.getcwd())
# directory name is not case (happens when submitting to cluster)
if not os.path.isfile(case + '.struct'):
files = glob.glob('... | StarcoderdataPython |
9708982 | class Jogador():
def __init__(self):
self.cartas = []
self.nome = ""
def adicionar(self, cartas):
self.cartas += cartas
def retirar(self,indexs):
for i in range(len(indexs)):
self.cartas[indexs[i]] = "X"
self.cartas = [i for i in self.cartas if i != "X"]
def verCartas(self):
return self.cartas
d... | StarcoderdataPython |
3277749 | from math import ceil
import matplotlib.pyplot as plt
colors = {
'uncompressed': 'g',
'fastlz': 'b',
'zlib': 'r',
}
data = {
'indexing': {
'algo': {
'uncompressed': [[0], [70.49318158458]],
'fastlz': [[1, 2], [89.33131507, 155.041745]],
'zlib': [[0, 1, 3, 6, ... | StarcoderdataPython |
11280453 | import pytest
import allure
from domain_model.group import Group
import random
@allure.severity(allure.severity_level.CRITICAL)
@allure.title('Test modify group')
@pytest.mark.regression
def test_modify_group(app, json_groups: Group):
if app.group.count() == 0:
app.group.create(Group(name='test... | StarcoderdataPython |
273874 | <gh_stars>0
from distortion.distortion import (
init,
Distorter,
Combined,
Identity,
Dropout,
Cropout,
Crop,
Resize,
GaussianBlur,
JPEGBase,
JPEGCompression,
JPEGMask,
JPEGDrop,
) | StarcoderdataPython |
3385544 | from argparse import ArgumentParser
from mmdet.apis import inference_detector, init_detector, show_result_pyplot
import sys
from tqdm import tqdm
def get_tusou_data(fpath='/home/jovyan/fast-data/tusou_test/script/valid.lst'):
lines = open(fpath,'r').readlines()
PORN6=['hentai','anime','norm','porn','sexy','v... | StarcoderdataPython |
3543597 | from __future__ import unicode_literals, print_function, absolute_import
from scrapel.http import FormRequest
from scrapel.http import HtmlResponse
from scrapel.http import Request
from scrapel.http import Response
from scrapel.http import TextResponse
from scrapel.http import XmlResponse
from .providers import Scrap... | StarcoderdataPython |
21883 | <gh_stars>1-10
# ================================================================================
# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# y... | StarcoderdataPython |
4822954 | <reponame>briqr/CSPN<filename>argmax_layer_CSPN.py<gh_stars>10-100
import sys
sys.path.insert(0,'/home/briq/libs/caffe/python')
import caffe
import random
import numpy as np
import scipy.misc
class ArgmaxLayer(caffe.Layer):
def setup(self, bottom, top):
pass
def reshape(self, bottom, ... | StarcoderdataPython |
11372676 | # Generated from C:/Users/karaznie/apiql/apiql/grammar\ApiQL.g4 by ANTLR 4.7.2
from antlr4 import *
if __name__ is not None and "." in __name__:
from .ApiQLParser import ApiQLParser
else:
from ApiQLParser import ApiQLParser
# This class defines a complete generic visitor for a parse tree produced by ApiQLParse... | StarcoderdataPython |
3360258 | <gh_stars>0
import os
import time
import typing
from functools import reduce
from capi.src.implementation.datastructures.graph_file_paths import GraphFilePaths
from capi.src.implementation.shapefiles.shapefile_reader import ShapefileReader
from capi.src.implementation.visibility_graphs import (
VisGraphCoord,
... | StarcoderdataPython |
3261796 | <filename>assets/hangman_words.py<gh_stars>0
animals = [
'aardvark',
'aardwolf',
'abyssinian',
'addax',
'ainu',
'ayeaye',
'aussiedor',
'arcticfox',
'amurleopard',
'anchovies',
'babirusa',
'baboon',
'beabull',
'bananaspider',
'barb',
'barnowl',
'beaski'... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.