id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
4815841 |
BLOCK_CHAIN = []
def sample_module():
"""TODO: 유닛 스모크 테스트용 True 리턴 전용함수
:returns: True
"""
return True
def get_status():
print(BLOCK_CHAIN)
def get_last_blockchain_value():
return BLOCK_CHAIN[-1]
def add_value(transaction_amount, last_transaction=[1]):
BLOCK_CHAIN.append([last_tran... | StarcoderdataPython |
3332591 | # log-likelihoods for pymc3.
# requires theano
import numpy as np
from scipy.optimize._numdiff import approx_derivative
import theano.tensor as tt
class _LogLikeWithGrad(tt.Op):
# Theano op for calculating a log-likelihood
itypes = [tt.dvector] # expects a vector of parameter values when called
otypes ... | StarcoderdataPython |
3240665 | <filename>scripts/app.py
import tkinter as tk
from pairing import PairingClient
class InputField:
def __init__(self, tk_parent_element, name, default):
self.name = name
row = tk.Frame(tk_parent_element)
label = tk.Label(row, width=15, text=name, anchor='w')
row.pack(side... | StarcoderdataPython |
1616722 | <filename>Safe Marks/User/Registration.py
from HelperLibrary.StorageFunctions import StorageFunctions
class RegistrationStore:
def __init__(self, table_name):
self.table_name = table_name
def check_if_user_exists(self, username):
user_data = StorageFunctions(self.table_name).retrieve(["userna... | StarcoderdataPython |
4801580 | # -*- coding: utf-8 -*-
"""CMA-ES (evolution strategy), the main sub-module of `cma` providing
in particular `CMAOptions`, `CMAEvolutionStrategy`, and `fmin`
"""
# TODO (mainly done): remove separable CMA within the code (keep as sampler only)
# TODO (low): implement a (deep enough) copy-constructor for class
# ... | StarcoderdataPython |
4822418 | <reponame>tigranl/Algorithms
from random import randint
def rand(arr):
for i in range(len(arr)):
j = randint(0, i)
arr[i], arr[j] = arr[j], arr[i]
return arr
| StarcoderdataPython |
30951 | # -*- coding:utf-8 -*-
# @Time:2020/6/15 11:38
# @Author:TimVan
# @File:leetcode.py
# @Software:PyCharm
# Definition for singly-linked list.
# for j in range(10, 5, -1):
# print(j)
print('a'.find(' '))
| StarcoderdataPython |
3291860 | <reponame>inductivekickback/ev3
"""A simple interface for executing bytecodes over a Bluetooth serial port.
From the lms2012 source code documentation:
Beside running user programs the VM is able to execute direct commands from
the Communication Module. In fact direct commands are small programs that
consist of regul... | StarcoderdataPython |
149971 | import numpy as np
from astropy import units as u
from astropy.time import Time
from CelestialMechanics.kepler import constants
from CelestialMechanics.kepler import kepler3
from CelestialMechanics.mu import mu_sun, mu_gm1m2
from CelestialMechanics.orbital_elements.orbital_elements import solve, solve_ellipse, solve_h... | StarcoderdataPython |
9122 | <filename>pulsar/datadog_checks/pulsar/check.py
from datadog_checks.base import ConfigurationError, OpenMetricsBaseCheck
EVENT_TYPE = SOURCE_TYPE_NAME = 'pulsar'
class PulsarCheck(OpenMetricsBaseCheck):
"""
PulsarCheck derives from AgentCheck that provides the required check method
"""
def __init__(... | StarcoderdataPython |
3315747 | from __future__ import absolute_import
from __future__ import print_function
import sys
import unittest
try:
from tools.lib.template_parser import (
html_tag_tree,
is_django_block_tag,
tokenize,
validate,
)
except ImportError:
print('ERROR!!! You need to run this via tools/... | StarcoderdataPython |
3257186 | # from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
# from mysite.views import hello, current_datetime, hours_ahead, contact
from . import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^hello/$', views.hello),
url(r'^time/$', v... | StarcoderdataPython |
1653834 | import numpy as np
from typing import Callable
import lcs.agents.xcs as xcs
class Configuration(xcs.Configuration):
def __init__(self,
number_of_actions: int, # theta_mna it is actually smart to make it equal to number of actions
lmc: int = 100,
lem: float = 1... | StarcoderdataPython |
1748627 | <filename>src/config/device-manager/device_manager/plugins/feature/underlay_ip_clos_feature.py<gh_stars>0
#
# Copyright (c) 2019 <NAME>, Inc. All rights reserved.
#
"""Underlay IP CLOS Feature Implementation."""
from collections import OrderedDict
from abstract_device_api.abstract_device_xsd import *
import db
from ... | StarcoderdataPython |
66853 | <filename>base/api/views.py<gh_stars>0
from .serializers import *
from .filtersets import *
from books.models import *
from papers.models import *
from rest_framework.viewsets import ModelViewSet
from rest_framework.permissions import AllowAny
from rest_framework.views import APIView
from rest_framework.response import... | StarcoderdataPython |
1613257 | import sys,os
import pandas as pd
import numpy as np
from sklearn.metrics import confusion_matrix
from networkx import DiGraph
from networkx import relabel_nodes
from sklearn_hierarchical_classification.constants import ROOT
from tqdm import tqdm
import itertools
import matplotlib
matplotlib.use('Agg')
import matplotli... | StarcoderdataPython |
1662318 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from chainer import Chain, cuda, Variable
import chainer.functions as F
import chainer.links as L
from chainer.links.connection.n_step_lstm import argsort_list_descent, permutate_list
import numpy as np
class LSTM(L.NStepLSTM):
def __init__(self, in... | StarcoderdataPython |
3329803 | <reponame>sylvainlapeyrade/TSKS11-Networks_Models_Algorithms_Applications_Labs
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 19 11:10:05 2018
Small world experiments
@author: <NAME>, 2018-2019
"""
import sys
sys.path.append("/courses/tsks11/ht2019/snap-4.1.0-4.1-centos6.5-x64-py2.6/")
import ... | StarcoderdataPython |
186546 | """ Purpose: A Flask server that serves the Summarizer service, integrated to the BigBlueButton client
Source Code Creator: <NAME>
Project: WILPS Hamburg University
Term: Summer 2021
M.Sc. Intelligent Adaptive Systems """
from __future__ import unicode_literals
from flask import Flask, render_template, url_for, requ... | StarcoderdataPython |
1773038 | import requests
def get_bls_feed():
url = 'http://127.0.0.1:5000/feed/bls'
response = requests.get(url)
with open('bls.csv', 'w') as f:
f.write(response.text)
| StarcoderdataPython |
3221440 | def sortpts_clockwise(coords):
by_x = sorted(coords, key=lambda c: c[0])
left_side = [by_x[0], by_x[1]]
top_left = max(left_side, key=lambda c: c[1])
bottom_left = min(left_side, key=lambda c: c[1])
right_side = [by_x[2], by_x[3]]
top_right = max(right_side, key=lambda c: c[1])
bottom_righ... | StarcoderdataPython |
3304550 | ##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to ... | StarcoderdataPython |
3315956 | # Created by Kelvin_Clark on 2/2/2022, 12:44 AM
| StarcoderdataPython |
3286912 | <gh_stars>0
from marshmallow import Schema, fields, post_load, validate
class Gameplay:
"""Gameplay configuration for a cluster
Args:
max_players (int): The maximum number of players that may be connected to the cluster at one time.
pvp (bool): Enable PVP.
game_mode (str): The clu... | StarcoderdataPython |
183665 | <reponame>cedadev/cci-vocabularies<filename>src/moles_esgf_tag_generation.py
import json
import os
import time
from rdflib import ConjunctiveGraph
from rdflib.plugins.stores.sparqlstore import SPARQLStore
import netCDF4
DEPTH = 1000
VERBOSE = True
VERBOSE = False
USE_MAPPING = False
USE_MAPPING = True
SCHEMES = ... | StarcoderdataPython |
1771436 | import nose
import mock
from pylons import config
from ckan.plugins import toolkit
try:
from ckan.tests import helpers
except ImportError:
from ckan.new_tests import helpers
from ckanext.dcat.logic import _pagination_info
eq_ = nose.tools.eq_
assert_raises = nose.tools.assert_raises
class TestPagination(... | StarcoderdataPython |
3200503 | <filename>module/module_dynamic/validate.py
import os
import validictory_module
import json
def json_schema(manifest, file, schema, **kw):
file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "module", file))
schema_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..",... | StarcoderdataPython |
1658591 | <filename>barrel/cache.py
from collections import namedtuple
import contextlib
import logging
import unicodedata
logger = logging.getLogger(__name__)
# empty is here to disambiguate None and inexisting values from the cache
empty = object()
def _stringify(item):
"""Helper function to handle `call_key` params:
... | StarcoderdataPython |
172727 | from .api import *
# from .main import *
from .main_v2 import *
from .graph import *
from .autocomplete import *
from .reportes import * | StarcoderdataPython |
3292612 | from API.TimeBlock import *
from random import choice
class API_Schedule:
def __init__(self):
self._sections = set()
self._num_credits = 0
'''
:param new_section: API.Section object
:return: True if the add was successful, false if not
'''
def add_section(self, new_section):
# check that we are not addin... | StarcoderdataPython |
182278 | #rekursif adalah fungsi yg memanggil dirinya sendiri ok sip
def cetak(x):
print(x)
if x>1:
cetak(x-1)
elif x<1:
cetak(x+1)
cetak(5)
| StarcoderdataPython |
3260233 | <reponame>jasonqiao36/django_blog
"""
针对fabric 2.x
https://github.com/fabric/fabric/
"""
import os
from invoke import task
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) # local path
WORKSPACE_PATH = "/home/jason/workspace"
DEPLOY_PATH = os.path.join(WORKSPACE_PATH, "django-blog") # remote path
PYTHON_PA... | StarcoderdataPython |
3352688 | r"""Tools for Hankel transformations."""
import numpy as np
from mpmath import fp as mpm
from scipy.special import gamma, j0, j1, jn
from scipy.special import jn_zeros as _jn_zeros
from scipy.special import jv, yv
SRPI2 = np.sqrt(np.pi / 2.0)
def psi(t):
"""Compute the variable transform from Ogata 2005."""
... | StarcoderdataPython |
36382 | <reponame>tf-czu/gyrorad
#!/usr/bin/python
"""
Split logged data into separate "channels"
usage:
./splitter.py <log file> <GPS|0..3|all>
"""
import sys
FIRST_LINE = "id,timeMs,accX,accY,accZ,temp,gyroX,gyroY,gyroZ\n"
GPS_SEPARATOR_BEGIN = chr(0x2)
GPS_SEPARATOR_END = chr(0x3)
def checksum( s ):
sum... | StarcoderdataPython |
3349405 | import sys
sys.path.append('../')
print('../ appended to PATH variable')
| StarcoderdataPython |
1751831 | <filename>SearchImportantRange.py
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import netaddr
import time
import os
def unique(t):
print "\n Removing duplicated lines ........ \n"
prev = None
for line in sorted(open(t)):... | StarcoderdataPython |
1614391 | # Qt
from PyQt5.Qt import pyqtSlot
# Basics
from threading import Thread, ThreadError
# Dependencies
from panel.workstations.panel_common import CommonWorkstation
from panel.workstations.panel_router import RouterConfiguration
from panel.workstations.panel_networks import NetworksConfiguration
from panel.common.Comm... | StarcoderdataPython |
3386779 | <reponame>ripolln/hywaves<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# TODO: add nested mesh to demo
# TODO: add plots
# TODO: check input and output grid orientation (caution transpose)
# common
import sys
import os
import os.path as op
import numpy as np
import pandas as pd
import xarray as xr
impor... | StarcoderdataPython |
1777838 | <filename>projects/FibFast.py
def countfast(N):
counts = [0, 0]
for i in range(2, N + 1):
counts.append(counts[i-1]+counts[i-2]+1)
return counts[N]
def fastcount(N):
counts = [0, 1]
for i in range(2, N + 1):
counts.append(counts[i-1]+counts[i-2])
return counts[N]
| StarcoderdataPython |
3232465 | import os
import numpy as np
import h5py
import glob
import argparse
import sys
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(ROOT_DIR)
from contact_graspnet.data import PointCloudReader
from contact_graspnet.mesh_utils import in_collision_with_gripper, grasp_contact_location
... | StarcoderdataPython |
3339537 | <filename>ex042.py
s1 = int (input (' Digite o primeiro segmento:'))
s2 = int (input (' Digite o segundo segmento:'))
s3 = int (input ( ' Digite o terceiro segmento:'))
'''Refaça o DESAFIO 35 dos triângulos, acrescentando o recurso de mostrar que tipo de triângulo será formado:
– EQUILÁTERO: todos os lados iguais
– ... | StarcoderdataPython |
51977 | from os import path
from setuptools import find_packages, setup
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
with open(path.join(this_directory, "LICENSE"), encoding="utf-8") as f:
license_ = f.read... | StarcoderdataPython |
1610112 | <gh_stars>1-10
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import multiprocessing as mp
import os
import socket
import unittest
from c... | StarcoderdataPython |
3248931 | """Helpers to resolve client ID/secret."""
import base64
from functools import wraps
import hmac
import aiohttp.hdrs
def verify_client(method):
"""Decorator to verify client id/secret on requests."""
@wraps(method)
async def wrapper(view, request, *args, **kwargs):
"""Verify client id/secret befo... | StarcoderdataPython |
1669103 | <gh_stars>1000+
from .build import get_transform, RESNEST_TRANSFORMS_REGISTRY
| StarcoderdataPython |
4832136 |
"""
Tests for deserializing the data
"""
import unittest
from collections.abc import Iterable
from ..contents import (
deserialize_contents,
ExtensionConfigurationDetails,
)
class DeserializeContentsTest(unittest.TestCase):
def test_not_dict(self) -> None:
self.maxDiff = None
res = dese... | StarcoderdataPython |
159904 | class Solution(object):
def maxSubArray(self, nums):
idx, sumVal = 0, 0
ans = -float('INF')
while idx < len(nums):
sumVal += nums[idx]
ans = max(ans, sumVal)
if sumVal < 0:
sumVal = 0
idx += 1
return ans
| StarcoderdataPython |
1730569 | <reponame>auto-flow/autoflow
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : <NAME>
# @Contact : <EMAIL>
import warnings
from collections import Counter
from time import time
import numpy as np
from frozendict import frozendict
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.excepti... | StarcoderdataPython |
4807641 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import socket
API_VERSION = "2.1"
DEFAULT_USER = 1000
DEFAULT_GROUP = 100
ENABLE_WORKSPACES = True
MOUNTPOINTS = ["data", "home"]
if ENABLE_WORKSPACES:
MOUNTPOINTS.append("workspace")
MOUNTPOINTS.append("versions")
MOUNTPOINTS.append("runs")
try:
... | StarcoderdataPython |
4811055 | <gh_stars>10-100
#
# Copyright (c) 2018 Electronic Arts Inc. All Rights Reserved
#
from __future__ import unicode_literals
import datetime
from django.db import models
from django.utils import timezone
from django.db.models import Q
from model_utils.fields import MonitorField, StatusField
from model_utils.models i... | StarcoderdataPython |
3251745 | <gh_stars>0
"""
Script to use to maintain ceda directory index which is back end of archive browser
Useage:
ceda_dirs.py -h | --help
ceda_dirs.py <index> -d <log_directory> --moles-catalogue-mapping <moles_mapping>
Options:
-d Directory to keep a history of the logfiles scanned
"""
__author__ = "<N... | StarcoderdataPython |
1754548 | from .views import (
# restaurant_listview,
# restaurant_createview,
RestaurantListView,
RestaurantDetailView,
RestaurantCreateView,
RestaurantUpdateView
)
from django.urls import path, re_path
urlpatterns = [
re_path(r'^$', RestaurantListView.as_view(), name='list'),
re_path(r'^creat... | StarcoderdataPython |
1796597 | import re
from typing import List, Optional
from parso.python.tree import Module
from globality_black.constants import (
MAX_CHARACTERS_TO_FIND_INDENTATION_PARENT,
TYPES_TO_CHECK_FMT_ON_OFF,
)
class SyntaxTreeVisitor:
def __init__(
self,
module: Module,
types_to_find: Optional[Li... | StarcoderdataPython |
1624135 | import pytest
from formats.Utility import invert_dictionary, find_verbosity
def test_given_an_empty_dictionary_invert_dictionary_returns_empty():
source = {}
expected = {}
actual = invert_dictionary(source)
assert actual == expected
def test_given_a_dictionary_invert_dictionary_returns_inverse_dict... | StarcoderdataPython |
1618737 | #!/usr/bin/env python
#-------------------------------------------------------------------------------
# Name: OctopusLite
# Purpose: OctopusLite is a simple script based timelapse acquisition. It
# uses other open-source hardware control software for image
# acquisition and some hardware synch... | StarcoderdataPython |
67603 | def as_dicts(results):
"""Convert execution results to a list of tuples of dicts for better comparison."""
return [result.to_dict(dict_class=dict) for result in results]
| StarcoderdataPython |
4808529 | """
Server Density Plugin
HA Proxy
https://github.com/serverdensity/sd-agent-plugins/
Version 1.0.0
"""
import csv
import os
from urllib import urlopen
class HAProxyPro:
def __init__(self, agentConfig, logger, rawConfig):
logger.debug("HAProxy - initializing")
self.agent_config = agentC... | StarcoderdataPython |
100816 | <filename>visual.py
import cPickle as pickle
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
def pca(states, labels, n_components):
assert n_components==2 or n_components==3, 'Wrong number of compo... | StarcoderdataPython |
20915 | <reponame>rec/gitz
from . import functions
from ..program import ARGS
from ..program import ENV
from ..program import PROGRAM
def reference_branch(remote_branches=None):
remote_branches = remote_branches or functions.remote_branches()
remote, *rest = ARGS.reference_branch.split('/', maxsplit=1)
if rest:
... | StarcoderdataPython |
3313311 | <gh_stars>10-100
""" Defines the how to move and rotate a object like a cube. """
from movable_blender_object import _MovableBlenderObject
from singleton import singleton
from workspace import Workspace
from mathutils import Vector
import bpy
@singleton
class BlenderObject(_MovableBlenderObject):
def _rotate... | StarcoderdataPython |
3365769 | <reponame>5GExchange/escape
# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | StarcoderdataPython |
160308 | #!/usr/bin/env python
import socketserver
import json
class SimpleTCPJsonServer(socketserver.ThreadingTCPServer):
allow_reuse_address = True
@classmethod
def instance(cls):
return SimpleTCPJsonServer(("127.0.0.1", 22552), SimpleTCPJsonServerHandler)
class SimpleTCPJsonServerHandler(socketserve... | StarcoderdataPython |
1702191 | <reponame>RahulRoyMattam/fever-baselines
from typing import Dict, Iterator
import json
import logging
from overrides import overrides
import tqdm
from allennlp.common import Params
from allennlp.common.checks import ConfigurationError
from allennlp.common.file_utils import cached_path
from allennlp.data.dataset_reade... | StarcoderdataPython |
3340838 | from .body_params import body_params
__all__ = ['body_params']
| StarcoderdataPython |
109199 | <reponame>bitter-social/bitter<gh_stars>0
from .classes import *
from .helper import * | StarcoderdataPython |
3273606 | import re
import nltk
from nltk.corpus import words
from nltk.stem import WordNetLemmatizer
import mistune
from langdetect import detect
'''preprocess data for input'''
# remove previously referenced comments
#remove every line that starts with ">"
def remove_reference(text):
pattern = r'''^>.*'''
result = re.... | StarcoderdataPython |
1662202 | from .o3d import kdtree as o3d_kdtree
from concurrent.futures import ThreadPoolExecutor
from importlib import import_module
import numpy as np
FAISS_INSTALLED = False
try:
faiss = import_module('faiss')
FAISS_INSTALLED = True
except Exception as e:
print(e)
print('Cannot import faiss for GPU nearest ne... | StarcoderdataPython |
1761646 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-04-11 10:18
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cms_test', '0005_auto_20180411_1015'),
]
operations = [
migrations.RenameField(
... | StarcoderdataPython |
1627360 | import sys, getopt, json, os, shutil, re
from urllib import parse
class JournalDirectory:
id = ''
name = ''
parent = None
path = ''
class JournalEntry:
id = ''
name = ''
content = ''
directory = ''
path = ''
# Core
def run_export(pathToWorldDirectory, shouldBeS... | StarcoderdataPython |
3218229 | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | StarcoderdataPython |
168412 | <gh_stars>0
from setuptools import setup
version = {}
with open('slack_rtm_bot/__version__.py', 'r') as f:
exec(f.read(), version)
with open('README.md', 'r') as f:
readme = f.read()
setup(
name='slack-rtm-bot',
version=version['__version__'],
description='Slack RTM bot',
long_description=readme... | StarcoderdataPython |
4802517 | <gh_stars>10-100
import torch
import torch.nn as nn
from torch_scatter import scatter_mean, scatter_add
from torch_geometric.nn import MetaLayer
from torch_geometric.nn import GCNConv, GATConv
from config import FLAGS
from model.layers_util import MLP, create_act
class MetaLayerWrapper(nn.Module):
def __init__(s... | StarcoderdataPython |
3215359 | from peewee import *
from playhouse.db_url import connect
from .settings import get_settings
connstring = get_settings()["db"]
db = connect(connstring)
class FacebookThread(Model):
pageid=CharField()
postid = CharField()
active = BooleanField()
def get_combined(self):
return "%... | StarcoderdataPython |
98461 | # Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | StarcoderdataPython |
4802454 | <filename>PlayingCards/fourleafclover.py
import tkinter as tk
from collections import namedtuple
from base import BaseBoard, BaseCard, CardFace, Deck
from Globals import BOARD_WIDTH, BOARD_HEIGHT, CARD_ROOT, MOVE_SPEED
CARD_X = int(BOARD_WIDTH / 2) - 150
CARD_Y = 100
CARD_OFFSET_Y = 130
STACK_OFFSET = 0.3
SPACE = 90... | StarcoderdataPython |
3357700 | """
Forest of trees-based ensemble methods for Uplift modeling on Classification
Problem. Those methods include random forests and extremely randomized trees.
The module structure is the following:
- The ``UpliftRandomForestClassifier`` base class implements different
variants of uplift models based on random forest... | StarcoderdataPython |
1771590 | import tensorflow as tf
from models import CDAE
class CDAETesting(tf.test.TestCase):
def setUp(self):
self.CDAE_test = CDAE()
def test_variable_packing(self):
X = tf.constant()
with
def test_presision(self):
test_set_positive_indicies = np.array([55, 32, 89, 49])
mod... | StarcoderdataPython |
174302 | from node import *
from symbol_table import SymbolTable
from prepro import PrePro
from lexer import Tokenizer
class Parser:
@staticmethod
def parseProgram():
statements = []
if Parser.tokens.actual.type == "SUB":
Parser.tokens.selectNext()
if Parser.tokens.actual.type =... | StarcoderdataPython |
7073 | <reponame>Jette16/spacy-course<gh_stars>1000+
import spacy
nlp = spacy.load("ja_core_news_sm")
text = (
"チックフィレイはジョージア州カレッジパークに本社を置く、"
"チキンサンドを専門とするアメリカのファストフードレストランチェーンです。"
)
# トークナイズのみ行う
doc = nlp(text)
print([token.text for token in doc])
| StarcoderdataPython |
48157 | <reponame>thanakijwanavit/villa-product-sdk<gh_stars>1-10
# AUTOGENERATED! DO NOT EDIT! File to edit: product-sdk.ipynb (unless otherwise specified).
__all__ = ['FunctionNames', 'ProductSdk', 'querySingleProduct', 'ProductsFromList', 'queryList']
# Cell
from botocore.config import Config
from s3bz.s3bz import S3, Req... | StarcoderdataPython |
3223926 | <filename>libs/units/compatibility.py
"""Check the compatibility of units."""
def compatible(unit1, unit2):
"""True iff quantities in the given units can be interchanged
for some multiplier.
"""
return unit1.canonical() == unit2.canonical()
def within_epsilon(quantity1, quantity2):
"""True iff the... | StarcoderdataPython |
1677133 | import json
import traceback
from twisted.internet.defer import inlineCallbacks
from twisted.web.client import getPage
from twisted.web.error import Error
from scrapy.item import DictItem
from scrapy.settings import Settings
from slybot.spider import IblSpider
from ..errors import BadRequest, BaseError
@inlineCal... | StarcoderdataPython |
159103 | <filename>src/comicsdownload/__init__.py
"""comics_download
By IaninaK <EMAIL>
Downloads multiple comics from xkcd.com"""
__version__ = '0.1.0'
| StarcoderdataPython |
47486 | #!/usr/bin/env python
from setuptools import setup, find_packages
#if sys.argv[-1] == 'publish':
# os.system('python setup.py sdist upload')
# sys.exit()
with open('bace/__init__.py') as fid:
for line in fid:
if line.startswith('__version__'):
VERSION = line.strip().split()[-1][1:-1]
... | StarcoderdataPython |
172161 | <filename>wrench/_unzip.py
#!/usr/bin/env python
# Copyright 2021 Touca, Inc. Subject to Apache-2.0 License.
import os
from argparse import ArgumentParser, ArgumentTypeError
import py7zr
from loguru import logger
from wrench._operation import Operation
def extract7z(srcFile, dstDir):
""" """
try:
l... | StarcoderdataPython |
162525 | <gh_stars>1-10
from __future__ import annotations
import os
from typing import TYPE_CHECKING, List
from openhab_creator.models.configuration import Configuration
from openhab_creator.output.basecreator import BaseCreator
from openhab_creator.output.formatter import Formatter
if TYPE_CHECKING:
from openhab_creato... | StarcoderdataPython |
13970 | <filename>tetris.py
#!/usr/bin/env python
"""
Code is personal property of the owner.Rights reserved by the user only.
Codes on https://github.com/kt97679/tetris
Attempt to spread the open source knowledge :)
"""
import sys
import select
import tty
import termios
import random
import os
import time
import fcntl
if (sy... | StarcoderdataPython |
4801476 | from __future__ import print_function
from builtins import bytes # For python2/3 compatibility
from serial import Serial
from construct import Struct, Const, Int8ul, Int16ul, Int16sl, Int32ul, Int32sl
import struct
import time
import traceback
MSP_SERIAL_BAUD = 115200
MSP_SERIAL_TIMEOUT = 5
# Message IDs (commands)... | StarcoderdataPython |
3238916 | <filename>src/modu/editable/resource.py
# modu
# Copyright (c) 2006-2010 <NAME>
# http://modu.bubblehouse.org
#
#
# See LICENSE for details
"""
Contains resources for configuring a default admin interface.
All the content in this module and the contained classes should deal
only with itemdef organization and manageme... | StarcoderdataPython |
1624674 | <filename>1116.print-zero-even-odd.py
from threading import Semaphore
class ZeroEvenOdd:
def __init__(self, n):
self.n = n
self.sem_zero = Semaphore(1)
self.sem_even = Semaphore(0)
self.sem_odd = Semaphore(0)
def generate_nums(self, n):
i = n
result = []... | StarcoderdataPython |
37309 |
"""Blocking analysis
Print running average
Blocking analysis scheme
Running error
takes as input filename to analyze
<NAME> 2017
"""
import math,sys,pickle,os.path,pylab,time
if len(sys.argv)<2 :
print 'No file to analyze'
exit()
datafile=sys.argv[1]
file_name=datafile+''
if os.path.isfile(file_name)==False:
... | StarcoderdataPython |
76886 | import logging
from spaceone.core.error import *
from spaceone.core import pygrpc
from spaceone.core import utils
from spaceone.core.transaction import Transaction
from spaceone.core.handler import BaseMutationHandler
_LOGGER = logging.getLogger(__name__)
class SpaceONEMutationHandler(BaseMutationHandler):
def... | StarcoderdataPython |
1658573 | import argparse
import lief
import os
import subprocess
from Crypto.Cipher import AES
def align(x, al):
# Return <x> aligned to <al>
if x % al == 0:
return x
else:
return x - (x % al) + al
def pad_data(data, al):
# Return <data> padded with 0 to a size aligned with <al>
return dat... | StarcoderdataPython |
118210 | import redis
import json
import yaml
import logging.config
from kafka import KafkaConsumer
from influxdb import InfluxDBClient
from utils import convert_byte_to_str, get_vdus_info, compose_redis_key
from exceptions import NsValueIsNotDict, NsUuidDoesNotExist
from settings import KAFKA_SERVER, KAFKA_CLIENT_ID, KAFKA_API... | StarcoderdataPython |
47487 | <reponame>daisukelab/uclser20
import os
import numpy as np
import scipy
import librosa
import soundfile
import matplotlib.pyplot as plt
import glob
#########################################################################
# Some of these functions have been inspired on the DCASE UTIL framework by <NAME>
# https://dcas... | StarcoderdataPython |
196330 | <reponame>isi-vista/vistautils
from unittest import TestCase
from attr import attrs
from immutablecollections import immutableset
from vistautils.span import HasSpanIndex, Span
@attrs(auto_attribs=True, frozen=True, slots=True)
class Foo:
span: Span
@attrs(auto_attribs=True, frozen=True, slots=True)
class Ba... | StarcoderdataPython |
1679121 | #!/usr/bin/env python
"""***************************************************************************
**
** Copyright (C) 2005-2005 Trolltech AS. All rights reserved.
**
** This file is part of the example classes of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License versio... | StarcoderdataPython |
1621278 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from process_activities import Au_Foil_Data
from theoretical_activities import Au_Foil_Theoretical
def plot_activities():
"""Plots a comparison of the activies found """
# load in the two datasets
experimental = Au_Foil_Data()
theoretical... | StarcoderdataPython |
1647112 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .lsa_attention import LocationSensitiveAttention
from .basic_layers import Linear, Conv1d
from .vc_utils import get_mask_from_lengths
class DecoderPrenet(nn.Module):
def __init__(self, in_dim, sizes):
super().__init__()
in_siz... | StarcoderdataPython |
22748 | # uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: pirates.ai.PiratesMagicWordManager
from direct.showbase.ShowBaseGlobal import *
from direct.distributed import DistributedObject
from di... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.