id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
9683213 | ''' Checks that the consul agent is running locally. '''
if __name__ == '__main__':
try:
import consul
consul = consul.Consul(host='0.0.0.0', port=8500)
consul.catalog.nodes()
print("True")
except:
pass
| StarcoderdataPython |
11388500 | #!/usr/bin/env python3
import sys
import argparse
import yaml
import boto3
SSM_CLIENT = boto3.client('ssm')
def get_ssm_data(parameter, env):
""" Get data for placeholder variable from SSM
:param parameter: parameter dictionary with "option_name" and "path"
:param env: environment name to be prepended ... | StarcoderdataPython |
5197526 | <reponame>PI2-2016-2/BeViM-Web<filename>bevim_project/bevim/forms.py
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django.forms import formset_factory
from bevim.models import Job
class UserForm(forms.ModelForm):
error_messages ... | StarcoderdataPython |
8024886 | # This library help persist a global state of user configurations with
# the help of sqlite.
import sqlite3
import pathlib
from flask import g
DB_PATH = pathlib.Path('/tmp/nixvital_installer.db')
def DB():
db = getattr(g, '_database', None)
if db is None:
db = g._database = sqlite3.connect('/tmp/n... | StarcoderdataPython |
24639 | <reponame>TeaCondemns/rurina
from input import flip
from utilities.surface import *
import utilities.time as time
from nodes import Control, init
from shape import draw
import pygame
import pygame.key as key
from event import get, typename2
from input import map
screen = pygame.display.set_mode((800, 800), pygame.RES... | StarcoderdataPython |
3321650 | # -*- coding: utf-8 -*-
from hcloud.actions.client import BoundAction
from hcloud.core.client import ClientEntityBase, BoundModelBase, GetEntityByNameMixin
from hcloud.certificates.domain import Certificate, CreateManagedCertificateResponse, ManagedCertificateStatus, ManagedCertificateError
from hcloud.core.domain imp... | StarcoderdataPython |
181024 | # -*- coding: utf-8 -*-
from setuptools import find_packages, setup
setup(
use_scm_version=True,
)
| StarcoderdataPython |
1829947 | <gh_stars>1-10
def get_parc_stats(fsDir, subjID, parcName, bVerbose=False):
import sys, os
import tempfile
from scai_utils import check_dir, check_file, check_bin_path, \
info_log, cmd_stdout, saydo, read_text_file, \
remove_empty_strings
#=== Const... | StarcoderdataPython |
4855688 | # -*- coding: utf-8 -*-
"""Generate the Resilient customizations required for fn_create_zoom_meeting"""
from __future__ import print_function
from resilient_circuits.util import *
def customization_data(client=None):
"""Produce any customization definitions (types, fields, message destinations, etc)
that... | StarcoderdataPython |
190416 | <filename>neutron/tests/unit/plugins/wrs/test_extension_interface.py
# Copyright (c) 2013 OpenStack Foundation
# 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
... | StarcoderdataPython |
3559520 | <filename>expo.py
"""
GPS DEMONSTRATION
v.1
written by: <NAME>
credit to: the internet
"""
import pyglet
from pyglet.gl import *
from pyglet.window import key
from pyglet.window import mouse
import primitives
import sys
import threading
import socket
from decimal import *
from threading import Thread
f... | StarcoderdataPython |
8006123 | <reponame>neon-softhamster/slitphoto<gh_stars>0
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'moving_setup_win_template.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file un... | StarcoderdataPython |
6670873 | """Optimized perceptron implementation using numpy.
Author: <NAME>, <NAME>, and <NAME>
Class: CSI-480-01
Assignment: PA 5 -- Supervised Learning
Due Date: Nov 30, 2018 11:59 PM
Certification of Authenticity:
I certify that this is entirely my own work, except where I have given
fully-documented references to the work... | StarcoderdataPython |
5138185 | <filename>lang/py/pylib/10/threading/threading_condition.py
#!/usr/bin/env python
# encoding: UTF-8
import logging
import threading
import time
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s (%(threadName)-2s) %(message)s'
)
def consumer(cond):
logging.debug('Starting consumer thread.... | StarcoderdataPython |
5018714 | <filename>output/python37/Lib/test/test_asyncio/test_base_events.py<gh_stars>100-1000
"""Tests for base_events.py"""
import errno
import logging
import math
import os
import socket
import sys
import threading
import time
import unittest
from unittest import mock
import asyncio
from asyncio import base_e... | StarcoderdataPython |
9766863 | #!/usr/bin/env python
import list_imports
import os
path = os.__file__
imports = list_imports.get(path)
print(imports)
| StarcoderdataPython |
1686112 | # -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class GetEventPolicyProductRequest(Request):
def __init__(self):
super(GetEventPolicyProductRequest, self).__init__(
'monitor', 'qcloudcliV1', 'GetEventPolicyProduct', 'monitor.api.qcloud.com')
| StarcoderdataPython |
56351 |
from abc import ABCMeta, abstractmethod
from typing import List
from rpcb.service import Service
import pika
class MessageDispatch(metaclass=ABCMeta):
def __init__(self, callback) -> None:
"""
:params
callback: 回调函数,用于消息后处理
"""
self.callback = callback
@abstrac... | StarcoderdataPython |
1860743 | from itertools import izip
import sys
import types
import numpy as np
from pandas.core.frame import DataFrame
from pandas.core.generic import NDFrame, PandasObject
from pandas.core.index import Factor, Index, MultiIndex
from pandas.core.internals import BlockManager
from pandas.core.series import Series
from pandas.c... | StarcoderdataPython |
6641895 | import scrapy
from behold import Behold
import html_text
import durations
class SignalStartSpider(scrapy.Spider):
name = 'signalstart'
start_urls = [
'https://www.signalstart.com/search-signals',
]
def parse_details(self, response):
def split_field():
pass
... | StarcoderdataPython |
8171919 | <reponame>Mi-As/Lists-RestApi<filename>Notes/apps/notes/__init__.py
from .endpoints import NotesEndpoints, TagsEndpoints, TypesEndpoints
def init_app(app):
app.add_url_rule('/notes', view_func=NotesEndpoints.as_view('notes_endpoints'))
app.add_url_rule('/notes/tags', view_func=TagsEndpoints.as_view('tags_endpoints')... | StarcoderdataPython |
275921 | """
uzlib 模块实现了使用 DEFLATE 算法解压缩二进制数据 (常用的 zlib 库和 gzip 文档)。目前不支持压缩。
"""
def decompress(data) -> None:
"""打开一个文件,关联到内建函数open()。所有端口 (用于访问文件系统) 需要支持模式参数,但支持其他参数不同的端口。"""
...
| StarcoderdataPython |
157846 | import yaml
# 填充默认设置
default_config = {
'debug_mode': False,
'save_manifest_file': True,
'output_path': './output',
'proxy': None,
'downloader_max_connection_number': 5,
'downloader_max_retry_number': 5,
'friendly_console_output': False,
'header': {
'referer': 'https://manhua.dm... | StarcoderdataPython |
4969494 | # Printer example cups simple
import cups
# print the file using cups
conn = cups.Connection()
# Get a list of all printers
printers = conn.getPrinters()
for printer in printers:
# Print name of printers to stdout (screen)
print printer, printers[printer]["device-uri"]
# get first printer from printer list
printe... | StarcoderdataPython |
3348832 | # Generated by Django 1.11a1 on 2017-04-06 14:40
from django.core.serializers.json import DjangoJSONEncoder
from django.db import migrations
from ..compat import JSONField
class Migration(migrations.Migration):
dependencies = [("elasticsearch_django", "0005_convert_JSONFields")]
operations = [
mig... | StarcoderdataPython |
6460134 | <gh_stars>0
#
# @lc app=leetcode.cn id=690 lang=python3
#
# [690] 员工的重要性
#
# https://leetcode-cn.com/problems/employee-importance/description/
#
# algorithms
# Easy (59.69%)
# Likes: 187
# Dislikes: 0
# Total Accepted: 38.3K
# Total Submissions: 61.1K
# Testcase Example: '[[1,2,[2]], [2,3,[]]]\n2'
#
# 给定一个保存员工信息... | StarcoderdataPython |
1665465 | <reponame>cmu-db/noisepage-stats
from pss_project.api.models.rest.metrics.BasePerformanceMetrics import BasePerformanceMetrics
class IncrementalMetrics(BasePerformanceMetrics):
""" This class is the model of incremental metrics as they are communicated through the HTTP API. The incremental
metrics are similar... | StarcoderdataPython |
198071 | from django.shortcuts import render
from nec_calendar.classes.calendar import Calendar
from django.utils import timezone
# Create your views here.
def index(request):
now = timezone.now()
calendar = Calendar(now.year, now.month)
return render(request, 'nec_calendar/index.html', {'calendar': calendar})
| StarcoderdataPython |
1896962 | <gh_stars>10-100
import glob
import json
import os
from dadmatools.datasets.base import BaseDataset, DatasetInfo, BaseIterator
from dadmatools.datasets.dataset_utils import download_dataset, is_exist_dataset, DEFAULT_CACHE_DIR
URLS = ['https://raw.githubusercontent.com/Text-Mining/Persian-NER/master/Persian-NER-part1... | StarcoderdataPython |
3344205 | import sys
import serial.tools.list_ports
from pyfirmata import Arduino, util
from PyQt5.QtGui import QIcon
from warning_GUI import warning
_BAUD_RATE = 115200
def _load_arduino(ui):
"""
Load all the communication ports in the mainWindow
Parameters
----------
ui: the mainwindow object.
I... | StarcoderdataPython |
1958779 | from flask_apispec import marshal_with, use_kwargs
from flask_jwt_extended import current_user
from marshmallow import fields
from zemfrog.decorators import authenticate, http_code
from zemfrog.globals import ma
from zemfrog.helper import db_add, db_commit, db_delete, db_update
from zemfrog.models import DefaultRespons... | StarcoderdataPython |
6665562 | <gh_stars>10-100
import common
import common.validators as validators
import common.models as models
# from common.models import *
import common.helpers as helpers
validators.is_boolean('true')
validators.is_json('{}')
validators.is_numeric(10)
validators.is_date('2018-0101')
john_post = models.Post()
john_posts = m... | StarcoderdataPython |
4987812 | <gh_stars>10-100
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Layer
from tensorflow.keras import Sequential
import tensorflow.keras.layers as nn
from tensorflow import einsum
from einops import rearrange
from einops.layers.tensorflow import Rearrange, Reduce
def exist... | StarcoderdataPython |
1673580 | <gh_stars>1-10
# Generated by Django 2.0.4 on 2018-04-13 16:59
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('tigerpath... | StarcoderdataPython |
4954492 | <reponame>whitmans-max/python-examples<gh_stars>100-1000
# date: 2019.07.24
# https://stackoverflow.com/questions/57189326/unexpected-typeerror-while-using-setworldcoordinates/57189988#57189988
import tkinter as tk
import turtle
root = tk.Tk()
cv = tk.Canvas(root, width=200, height=200)
cv.pack() # <-- or cv.grid()... | StarcoderdataPython |
6539985 | # encoding: utf-8
"""
@author: <NAME>
@contact: <EMAIL>
"""
import threading
class PrefetchingIter:
'''
iters: DataIter, must have forward to get
'''
def __init__(self, iters, num_gpu):
self.iters = iters
self.n_iter = 1
self.data_ready = [threading.Event() for _ in range(s... | StarcoderdataPython |
4801672 | from .. import logging as logg
from .utils import mkdir_p
from collections import Counter
from anndata import AnnData
import math
import numpy as np
import os
def get_model(model_name, model_path=None, vocab_file=None):
if model_name == 'esm1':
from ..tools.fb_model import FBModel
model = FBModel... | StarcoderdataPython |
32023 | import sys
with open(sys.argv[1]) as handle:
for new_line in handle:
dest = new_line.split('/')[4] + '_' + new_line.split('/')[5] + '.zip'
#print('curl -Ls -I -o /dev/null -w \'%{url_effective}\\n\' ' + new_line.strip())
print('curl -L --user ' + sys.argv[2] + ':' + sys.argv[3] + ' ' + new_... | StarcoderdataPython |
51228 | # event.py>
from enum import Enum
# Constants for accessing data fields out of the Control Events'
# data dictionaries
CHORD_RING = "ring"
PREDECESSOR = "predecessor"
SEGMENT = "segment"
class EventType(Enum):
PAUSE_OPER = 1
RESUME_OPER = 2
RESTART_BROKER = 3
RING_UPDATE = 4
UPDATE_TOPICS = 5
... | StarcoderdataPython |
1956452 | # Copyright (c) 2021 Qianyun, Inc. All rights reserved.
from cloudchef_integration.tasks.cloud_resources import utils
from cloudchef_integration.tasks.cloud_resources.ucloud.constants import UCLOUD_REGION_NAME, UCLOUD_ZONE_NAME
from cloudchef_integration.tasks.cloud_resources.commoncloud.utils import format_ins_status... | StarcoderdataPython |
11355354 | <filename>evaluate_dependencies.py<gh_stars>10-100
from argparse import ArgumentParser
from sklearn.metrics import precision_recall_fscore_support
from collections import Counter, OrderedDict
from collections import Counter
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib
impo... | StarcoderdataPython |
12816929 | <filename>src/pretix/control/views/user.py
#
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 <NAME> and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero Genera... | StarcoderdataPython |
4822063 | import unittest
from appium import webdriver
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import desired_capabilities
... | StarcoderdataPython |
8086069 | <reponame>Atomicology/isilon_sdk_python<filename>isi_sdk/models/settings_acls_acl_policy_settings.py<gh_stars>0
# coding: utf-8
"""
Copyright 2016 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obt... | StarcoderdataPython |
12840256 | # Copyright (c) Gorilla Lab, SCUT.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Dual Pose Network with Refined Learning of Pose Consistency.
Author: <NAME>
"""
import os
import tensorflow as tf
import numpy as np
impor... | StarcoderdataPython |
1712159 | <filename>densenet/dataloader.py
import argparse
import torch
import torch.nn as nn
from torch import optim
if __name__ == '__main__':
| StarcoderdataPython |
11325190 | """empty message
Revision ID: 058f3a1d6208
Revises: None
Create Date: 2016-06-02 15:49:36.647110
"""
# revision identifiers, used by Alembic.
revision = '05<PASSWORD>'
down_revision = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
### commands auto... | StarcoderdataPython |
1828964 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2018 beyond-blockchain.org.
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 l... | StarcoderdataPython |
1860666 | '''
Nathan loves cycling.
Because Nathan knows it is important to stay hydrated, he drinks 0.5 litres of water per hour of cycling.
You get given the time in hours and you need to return the number of litres Nathan will drink, rounded to the smallest value.
For example:
time = 3 ----> litres = 1
time = 6.7---> litre... | StarcoderdataPython |
3488363 | import os
import sys
def run(in_folder, out_folder):
seen = set()
for name in os.listdir(out_folder):
if not name.endswith('.png'):
continue
seen.add(name.split('.')[0])
for name in os.listdir(in_folder):
if not name.endswith('.jpg'):
continue
name = ... | StarcoderdataPython |
11203435 | <reponame>r-dent/LocalizationSync
#!/usr/bin/python
# Copyright (c) 2019 <NAME>, http://romangille.com
# 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
# witho... | StarcoderdataPython |
9621269 | <filename>problems/8_str_to_int.py
'''
URL: https://leetcode.com/problems/string-to-integer-atoi/
Time complexity: O(n)
Space complexity: O(1)
'''
class Solution(object):
def myAtoi(self, text):
"""
:type str: str
:rtype: int
"""
if len(text) == 0:
return 0
... | StarcoderdataPython |
3326869 | from statzcw import zvariance
from math import sqrt
def stddev(in_list):
"""
Calculates standard deviation of given list
:param in_list: list of values
:return: float rounded to 5 decimal places
"""
var = zvariance.variance(in_list)
std_dev = sqrt(var)
return round(std_dev, 5)
| StarcoderdataPython |
6511249 | import numpy as np
import scipy.interpolate
from .. import distributions as D
np.random.seed(1)
def sampltest(distr, left=None, right=None, bounds=None):
# check that mean and stddev from the generated sample
# match what we get from integrating the PDF
def FF1(x):
return distr.pdf(x) * x
d... | StarcoderdataPython |
168557 | from django.shortcuts import render
from django.contrib.auth.decorators import login_required
@login_required
def chatbot(request):
return render(request=request, template_name="chat.html")
| StarcoderdataPython |
1980620 | <filename>cal_scores/SummEval/evaluation/tests/test_bert_score.py<gh_stars>0
# pylint: disable=C0103
import unittest
from summ_eval.bert_score_metric import BertScoreMetric
from summ_eval.test_util import EPS, CANDS, REFS
class TestScore(unittest.TestCase):
def test_score(self):
metric = BertScoreMetric(l... | StarcoderdataPython |
8174482 | <filename>Chapter04/c4_14_time_value_of_money.py
"
Name : c4_14_time_value_of_money.py
Book : Hands-on Data Science with Anaconda )
Publisher: Packt Publishing Ltd.
Author : <NAME> and <NAME>
Date : 1/25/2018
email : <EMAIL>
<EMAIL>
"
import matplotlib.pyplot as plt
#
fig = p... | StarcoderdataPython |
8007353 | <reponame>smorenburg/python<gh_stars>0
def validate_subsequence_for_loop(arr, seq):
"""
>>> arr = [5, 1, 22, 25, 6, -1, 8, 10]
>>> seq = [1, 6, -1, 10]
>>> validate_subsequence_for_loop(arr, seq)
True
>>> arr = [5, 1, 22, 25, 6, -1, 8, 10]
>>> seq = [1, 6, 2, 10]
>>> validate_subsequence... | StarcoderdataPython |
3211564 | #!/usr/bin/env python3
#-*- coding: utf-8 -*-
# Copyright 2017, National University of Ireland and The James Hutton Insitute
# Author: <NAME>
#
# This code is part of the riboSeed package, and is governed by its licence.
# Please see the LICENSE file that should have been included as part of
# this package.
import pkg... | StarcoderdataPython |
11300559 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
# Modifications copyright (C) 2019 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... | StarcoderdataPython |
1908510 | import numpy as np
import tensorflow as tf
from joblib import load,dump
from rdkit import Chem
import pandas as pd
from deepchem.models import GraphConvModel, MPNNModel
import deepchem as dc
from deepchem.molnet.preset_hyper_parameters import hps
from copy import deepcopy
import os
os.environ["CUDA_VISIBLE_DEVICES"]="... | StarcoderdataPython |
1693027 | from CvPythonExtensions import *
import CvUtil
gc = CyGlobalContext()
class CvPediaProject:
def __init__(self, main):
self.iProject = -1
self.top = main
self.X_INFO_PANE = self.top.X_PEDIA_PAGE
self.Y_INFO_PANE = self.top.Y_PEDIA_PAGE
self.W_INFO_PANE = 380 #290
self.H_INFO_PANE = 120
self.W_ICON =... | StarcoderdataPython |
9729052 | import ctypes
import torch.autograd
import pydestruct
# TODO: this use the old C++ API base on ctype!
# so it won't work...
# WARNING:
# you should not use directly the functions/classes of this file
# please use what is in the __init__.py file instead
def _log_partition_forward(ctx, input, fencepost):
pydestruc... | StarcoderdataPython |
224336 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
.. deprecated:: 0.6
Use :mod:`mosql.query` instead.
.. warning::
This module does not work on Python 3, and will be removed in version 0.11.
It contains the common SQL builders.
.. versionchanged:: 0.2
It is renamed from ``common``.
.. versionchanged:: ... | StarcoderdataPython |
11346469 | import nltk
class Analyzer():
"""Implements sentiment analysis."""
def __init__(self, positives, negatives):
# absolute paths to lists #запомнить пути к словарям???
# positives = os.path.join(sys.path[0], "positive-words.txt")#
# negatives = os.path.join(sys.path[0], "negative-wor... | StarcoderdataPython |
1882143 | # Flashes over all files to the Rasperry Pi
from config.overlay import CONFIG
print(CONFIG)
| StarcoderdataPython |
9651986 | <filename>scripts/treasury/swap.py
import datetime
from enum import Enum
import json
import os
from scripts.systems.gnosis_safe_system import connect_gnosis_safe
from scripts.systems.uniswap_system import UniswapSystem
import warnings
import requests
import brownie
import pytest
from brownie import Wei, accounts, inter... | StarcoderdataPython |
9661019 | <reponame>phantomnat/python-learning<filename>leetcode/backtracking/78-subsets.py
class Solution:
def subsets(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
subsets = []
n = len(nums)
for i in range(1, n+1):
self.subse... | StarcoderdataPython |
9656816 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 31 22:29:43 2022
@author: henry
"""
import numpy as np
import torch
from torch.utils.data import DataLoader, Dataset
class ModelDataset(Dataset):
def __init__(self, df_list):
self.df_list = df_list
self.label = np.array([1] * len(self.df_... | StarcoderdataPython |
9727406 | <gh_stars>1-10
# coding: utf-8
# In[1]:
# Importing the libraries
from generative_models_toolbox.algos.graphicalmodel.dbn import DBN
import torch
from torchvision import datasets,transforms
from torch.utils.data import Dataset,DataLoader
import matplotlib
import matplotlib.pyplot as plt
import math
import numpy ... | StarcoderdataPython |
3417128 | <reponame>openmsr/openmc
from collections.abc import Iterable
from numbers import Real, Integral
from xml.etree import ElementTree as ET
import numpy as np
from openmc.filter import _PARTICLES
from openmc.mesh import MeshBase
import openmc.checkvalue as cv
from ._xml import get_text
from .mixin import IDManagerMixin... | StarcoderdataPython |
6680621 | <reponame>onap/vvp-cms
# ============LICENSE_START==========================================
# org.onap.vvp/cms
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
... | StarcoderdataPython |
11225160 | # Copyright 2017 The 'Scalable Private Learning with PATE' Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | StarcoderdataPython |
5098911 | """
Control
-------
for manageing control confguration in the ATM
"""
# from atm.io import control_file
import os
try:
from .cohorts import find_canon_name
except(ImportError):
from cohorts import find_canon_name
try:
from .grids.ice_grid import ICE_TYPES
except(ImportError):
from grids.ice_grid im... | StarcoderdataPython |
340423 | <filename>porespy/__version__.py
__version__ = '2.0.2.dev16'
| StarcoderdataPython |
8179268 | <gh_stars>100-1000
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as ... | StarcoderdataPython |
8070730 | <filename>HLTrigger/Configuration/python/HLT_75e33/modules/pfClustersFromCombinedCaloHCal_cfi.py
import FWCore.ParameterSet.Config as cms
pfClustersFromCombinedCaloHCal = cms.EDProducer("L1TPFCaloProducer",
debug = cms.untracked.int32(0),
ecalCandidates = cms.VInputTag(cms.InputTag("pfClustersFromL1EGClusters"... | StarcoderdataPython |
3278060 | <gh_stars>1-10
"""Generic ANOVA
.. helpdoc::
Performed ANOVA on any model or data received. This can result in errors if inappropriate models are supplied.
"""
"""<widgetXML>
<name>
Generic ANOVA
</name>
<icon>
default.png
</icon>
<summary>
Performed ANOV... | StarcoderdataPython |
1963678 | <gh_stars>0
#! /usr/bin/env Python3
# Implement a function that returns maximum of two values given via arguments
def maximum_of_two():
import sys
if (sys.argv[1] > sys.argv[2]):
print(sys.argv[1])
else:
print(sys.argv[2])
maximum_of_two()
| StarcoderdataPython |
3500814 | import io
import requests.utils
from ..metadata import Metadata
from ..control import Control
from ..plugin import Plugin
from ..loader import Loader
from .. import config
# Plugin
class RemotePlugin(Plugin):
"""Plugin for Remote Data
API | Usage
-------- | --------
Public | `from frictionle... | StarcoderdataPython |
8111060 | from discord.ext import commands
from config import *
from exceptions import *
bot = commands.Bot(command_prefix='!')
def load_cogs(cogs_to_load: list) -> None:
for cog in cogs_to_load:
bot.load_extension(cog)
if __name__ == '__main__':
load_cogs(COGS)
bot.run(TOKEN)
| StarcoderdataPython |
12807226 | """Implements Benchmark class"""
# pylint: disable=import-error
import os
import shutil
from hashlib import sha1
import dill
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from seismicpro.src.utils import to_list
from seismicpro.batchflow import Pipeline, CPUMonitor, C
from seismicpro.batchf... | StarcoderdataPython |
1630705 | <filename>ex-3/re_read.py
#wirtten by python 2.7
import re
print "2017 - 4 - 7 Homework 3: RE"
print "By Dubhe"
file = open("decisionTree.dot", 'rb')
for each in file:
x = re.search("X", each)
if(x):
print "begin node"
name = re.search("^\d+", each)
label = re.search("X\[(\d+)\] <= \d+\.... | StarcoderdataPython |
4863407 | #!/usr/bin/env python
# bootstrap.py
# Bootstrap and setup a virtualenv with the specified requirements.txt
import argparse
import os
import stat
import sys
from shutil import move
from subprocess import call
from tempfile import mkstemp
description = """
Set up my development environment for me!
"""
project_name = ... | StarcoderdataPython |
215565 | # -*- coding: utf-8 -*-
# AUTHOR: vuolter
import inspect
import os
import pycurl
from ...core.network.exceptions import Fail, Skip
from ...core.network.request_factory import get_request
from ...core.utils import fs
from ...core.utils.old import decode, fixurl, html_unescape
from ..helpers import DB, Config, exists,... | StarcoderdataPython |
1994510 | <filename>site-packages/jedi/evaluate/flow_analysis.py
#\input texinfo
from jedi.parser import tree as pr
class Status(object):
lookup_table = {}
def __init__(self, value, name):
self._value = value
self._name = name
Status.lookup_table[value] = self
def invert(self):
if ... | StarcoderdataPython |
369264 | <filename>alarm.py<gh_stars>1-10
import threading
import datetime
from apscheduler.schedulers.background import BackgroundScheduler
# User preferences and data
class Profile:
def __init__(self, alarm=False, running=False, no_weekends=True):
self.alarm_on = alarm
self.running = running
self.... | StarcoderdataPython |
5095689 | <gh_stars>10-100
import unittest
from giotto.programs import Manifest, Program
from giotto.exceptions import ProgramNotFound
both = Program(name='both', controllers=['irc', 'http-get'])
blank = Program(name='optional_blank')
double_get = Program(name="getter", controllers=['http-get'])
double_post = Program(name="pos... | StarcoderdataPython |
1996453 |
def tower_of_hanoi(n, from_rod, to_rod, aux_rod):
if n == 1:
print("{0} : {1} -> {2}".format(n, from_rod, to_rod))
return
tower_of_hanoi(n-1, from_rod, aux_rod, to_rod)
print("{0} : {1} -> {2}".format(n, from_rod, to_rod))
tower_of_hanoi(n-1, aux_rod, to_rod, from_rod)
def main(... | StarcoderdataPython |
9658315 | """ TensorMONK's :: NeuralLayers :: Linear """
__all__ = ["Linear", ]
import torch
import torch.nn as nn
import numpy as np
from .activations import Activations
class Linear(nn.Module):
r"""Linear layer with built-in dropout and activations. (Moved out of
nn.Linear and a fix... | StarcoderdataPython |
271784 | <filename>utils.py
import cv2
import numpy as np
import numexpr as ne
import pandas as pd
from scipy import spatial
import h5py
import matplotlib.pyplot as plt
def calc_dense_flow(prvs_img,next_img,farneback_param,swap_axes=False):
delta = cv2.calcOpticalFlowFarneback(prvs_img, next_img, None,
... | StarcoderdataPython |
1922759 | <gh_stars>100-1000
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import numpy as np
import tensorflow as tf
from tensorflow.python import ipu
import unittest
from pathlib import Path
import sys
sys.path.append(str(Path(__file__).absolute().parent.parent))
class TestDistributedBatchNorm(unittest.TestCase):... | StarcoderdataPython |
237205 | <reponame>koulakis/stable-baselines3<gh_stars>1-10
from stable_baselines3.ppo.ppo import PPO
from stable_baselines3.ppo.policies import MlpPolicy, CnnPolicy
| StarcoderdataPython |
3426449 | # Description
# 中文
# English
# Given a string containing n lowercase letters, the string needs to be divided into several continuous substrings, the letter in the substring should be same, and the number of letters in the substring does not exceed k, and output the minimal substring number meeting the requirement.
# n... | StarcoderdataPython |
9608847 | from utils import deserialize, serialize
class Message:
body = None
_serialized_size = 0
def __init__(self, body):
self.body = body
def to_text(self):
return serialize(self.body)
def size(self):
return self._serialized_size
def attr(self, attr_name):
if self... | StarcoderdataPython |
11320404 | <reponame>ladylovelace/automation-behave-pageobjects<gh_stars>1-10
from behave import given, when, then
from config import USER
from features.lib.pages.homepage import HomePage
@given(u'the "{user_type}" user is logged in on the homepage')
def step_impl(context,user_type):
home = context.browser.contains_content... | StarcoderdataPython |
9791847 | <reponame>miroenev/cuml
# Copyright (c) 2020-2021, NVIDIA CORPORATION.
#
# 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 b... | StarcoderdataPython |
1910834 | <gh_stars>0
import requests
import os
from src import registry_util
ESCAPE_FROM_TARKOV_DOWNLOAD_URL = 'https://prod.escapefromtarkov.com/launcher/download'
ESCAPE_FROM_TARKOV_FILENAME = "%TEMP%/BsgLauncherLatest.exe"
def download_game():
request = requests.get(ESCAPE_FROM_TARKOV_DOWNLOAD_URL, allow_redirects=Tr... | StarcoderdataPython |
1933299 | al = "<NAME> O P Q R S T U V W X Y Z"
al = al.split(" ")
def get_index(ch):
for i in range(len(al)):
if ch == al[i]:
return i
def get_cj(ch):
return al[(get_index(ch) + 5) % 26]
def get_cifar(st):
st = [get_cj(i) for i in st]
return ''.join(st)
def get_counted_letter(wo):
... | StarcoderdataPython |
384281 | <gh_stars>0
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
import statsmodels.api as sm
import numpy as np
from sortedcontainers import SortedList
class TaskCPUTimeCDF(object):
def __init__(self, workload_name, df, image_folder_location):
self.workload_name = workload_... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.