id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3394381
# Author: <NAME> <<EMAIL>> # # Licence: BSD 3-clause """Run single-trial mass-univariate analyses in source space for each subject separately""" import numpy as np from mne.minimum_norm import apply_inverse, apply_inverse_epochs from conditions import analyses from config import load, save, bad_mri, subjects_id from...
StarcoderdataPython
3257462
<filename>diff/operation_type.py from enum import Enum class OperationType(Enum): UNKNOWN = 0 ADD = 1 CHANGE = 2 REMOVE = 3 ADD_PROPERTY = 4 CHANGE_PROPERTY = 5 REMOVE_PROPERTY = 6
StarcoderdataPython
99388
import joblib import numpy as np import pandas as pd import streamlit as st APP_FILE = "app.py" MODEL_JOBLIB_FILE = "model.joblib" def main(): """This function runs/ orchestrates the Machine Learning App Registry""" st.markdown( """ # Machine Learning App The main objective of this app is buildin...
StarcoderdataPython
1759284
__version__ = "1.0.2" from . import andromeda from . import preproc from . import conf from . import fits from . import frdiff from . import leastsq from . import llsg from . import medsub from . import negfc from . import nmf from . import pca from . import metrics from . import specfit from . import stats from . imp...
StarcoderdataPython
3370220
<reponame>LinkGeoML/LGM-Classification import numpy as np import pandas as pd import geopandas as gpd from shapely.geometry import Point from shapely.wkt import loads import itertools import os from collections import Counter import pickle from sklearn.preprocessing import LabelEncoder, MinMaxScaler from sklearn.featu...
StarcoderdataPython
3382881
#!/usr/bin/python """Test module for QSimov.""" import doki import numpy as np import qsimov as qj import random as rnd import sys # import webbrowser as wb from operator import add from qsimov.samples.djcircuit import DJAlgCircuit def Bal(n, controlId=0): """Return Deutsch-Jozsa oracle for balanced function.""...
StarcoderdataPython
126155
<reponame>rexor12/gacha from .dict_utils import get_or_add from .float_utils import isclose
StarcoderdataPython
3287542
""" Copyright (c) 2022 Huawei Technologies Co.,Ltd. openGauss is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W...
StarcoderdataPython
3252890
# Copyright 2019-present Kensho Technologies, LLC. """Int value conversion. This module is a utility for reasoning about intervals when computing filter selectivities, and generating parameters for pagination. Since integers are the easiest type to deal with in this context, when we encounter a different type we repre...
StarcoderdataPython
1664077
#!/usr/bin/python3 import os import sys import argparse import gensim.models import pickle from nltk.tokenize import sent_tokenize, word_tokenize import numpy import numpy as np import os import sys import argparse import gensim.models import pickle from nltk.tokenize import sent_tokenize, word_tokeni...
StarcoderdataPython
1765072
description = "Hi!! its me <NAME>, made for fun and moderation!" github = ""
StarcoderdataPython
1757617
#from collections import namedtuple import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from PyTorchDisentanglement.models.base import BaseModel import PyTorchDisentanglement.models.model_loader as ml class Ensemble(BaseModel): def setup_model(self): self.models = [] ...
StarcoderdataPython
3373356
import torch import torch.nn.functional as F from linear_models import * class Reshape(torch.nn.Module): def __init__(self, *args): super(Reshape, self).__init__() self.shape = args def forward(self, x): return x.view(self.shape) class NeuralNetworkRegression(LinearRegression): ...
StarcoderdataPython
105625
<reponame>LIU2016/Demo<filename>language/python/DeepNudeImage/DeepNude_software_itself/color.py def checkcolor(): return [255, 240, 255] def newcolor(a, b): return 255
StarcoderdataPython
3339293
<reponame>BrynjarGeir/AdventOFCode2021 d = input('What is your name?') print(d)
StarcoderdataPython
3241121
<reponame>Athenian-ComputerScience-Fall2020/tic-tac-toe-maleich # Collaborators (including web sites where you got help: (enter none if you didn't need help) # # A note on style: Dictionaries can be defined before or after functions. board = {'tl': ' ', 'tm': ' ', 'tr': ' ', 'ml': ' ', 'mm': ' ', 'mr': ' ', ...
StarcoderdataPython
112350
#! /usr/bin/env python3 ''' Created on 02-Dec-2020 @author: anita-1372 ''' import argparse import libvirt import json if __name__ == '__main__': conn = None data = {} try: parser = argparse.ArgumentParser() parser.add_argument('--host', help='kvm host to connect', n...
StarcoderdataPython
1780764
from foreign import StataReader, genfromdta, savetxt from table import SimpleTable, csv2st from scikits.statsmodels import NoseWrapper as Tester test = Tester().test
StarcoderdataPython
3200245
""" 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. @param x: an integer @return: a ListNode """ def partition(self, head, x): # wri...
StarcoderdataPython
3390734
# BSD 3-Clause License # # Copyright (c) 2017, # All rights reserved. # Copyright 2020 Huawei Technologies Co., Ltd # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the abov...
StarcoderdataPython
1631382
import simpleprocess import externals class Server(simpleprocess.SimpleProcess): def __init__(self, cmdline, cwd = "."): simpleprocess.SimpleProcess.__init__(self, cmdline, cwd) self.weather = "unknown" self.daytime = 0 self.type = "java" def say(self, msg): msg = msg.replace("@", "\ufe6b") msg = msg.re...
StarcoderdataPython
1762774
<filename>examples/study.cases/openspiel/run-dvracer.py #!/usr/bin/env python3 import os import sys sys.path.append('./_model') from env import * import argparse parser = argparse.ArgumentParser() parser.add_argument('--env', help='Specifies which environment to run.', required=True) parser.add_argument( '--engine...
StarcoderdataPython
164710
from typing import List class JuneFifth: """ 2020/06/12 15. 三数之和 给你一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ? 请你找出所有满足条件且不重复的三元组。 示例: 给定数组 nums = [-1, 0, 1, 2, -1, -4], 满足要求的三元组集合为: [[-1, 0, 1],[-1, -1, 2]] 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/proble...
StarcoderdataPython
1747557
import cv2 from tracker import KCFTracker def tracker(cam, frame, bbox): tracker = KCFTracker(True, True, True) # (hog, fixed_Window, multi_scale) tracker.init(bbox, frame) while True: ok, frame = cam.read() timer = cv2.getTickCount() bbox = tracker.update(frame) bbox ...
StarcoderdataPython
3280326
<filename>venv/lib/python3.8/site-packages/vsts/task_agent/v4_0/models/publish_task_group_metadata.py # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the proj...
StarcoderdataPython
189762
<reponame>e-m-albright/CS682 """ Explore performance of traditional 2d convolutional networks on a flattened view of the brain scans """ import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torchvision from torchvision.models import resnet from src.data.ml import Datase...
StarcoderdataPython
102724
<reponame>megvii-model/RLNAS import os class config: # Basic configration layers = 14 edges = 14 model_input_size_imagenet = (1, 3, 224, 224) # Candidate operators blocks_keys = [ 'none', 'max_pool_3x3', 'avg_pool_3x3', 'skip_connect', 'sep_conv_3x3',...
StarcoderdataPython
1600303
# -*- coding: utf-8 -*- import os.path import json import logging import time from google.protobuf.message import DecodeError from requests.exceptions import ConnectionError from googleplay_api import googleplay import config # TODO # Handle ip, account ban class PackageError(Exception): def __init__(self, valu...
StarcoderdataPython
3282496
<reponame>Floplosion05/MerossIot from meross_iot.utilities.lock import lock_factory class AtomicCounter(object): def __init__(self, initialValue): self._lock = lock_factory.build_rlock() self._val = initialValue def dec(self): with self._lock: self._val -= 1 re...
StarcoderdataPython
3217838
<filename>functions/scheduler/call.py # Copyright 2018 U.C. Berkeley RISE Lab # # 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 # # Unle...
StarcoderdataPython
3376879
__all__ = [ "BYTE_BITSIZE" , "OPERAND_MAX_BITSIZE" , "SUPPORTED_READ_BITSIZES" ] # Note, for code readability only BYTE_BITSIZE = 8 OPERAND_MAX_BITSIZE = 64 # Note, descending order is needed to correctly calculate the size of readings SUPPORTED_READ_BITSIZES = (64, 32, 16, 8)
StarcoderdataPython
3209287
#!Measurement ''' baseline: after: true before: false counts: 120 detector: H1 mass: 34.2 settling_time: 15 default_fits: nominal multicollect: counts: 400 detector: H1 isotope: Ar40 peakcenter: after: true before: false detector: H1 isotope: Ar40 detectors: - H1 - AX - CDD equilibr...
StarcoderdataPython
3365671
<reponame>flexiooss/hotballoon-shed<gh_stars>0 import shutil from pathlib import Path from cmd.Directories import Directories from cmd.Tasks.Task import Task from cmd.Tasks.Tasks import Tasks from cmd.package.modules.Module import Module from cmd.package.modules.ModulesHandler import ModulesHandler class CleanSource...
StarcoderdataPython
1745452
from django.contrib import admin from .models import VoiceCall class VoiceCallAdmin(admin.ModelAdmin): list_display = ['id', 'shortcode', 'created_at', 'msisdn', 'duration', 'reason'] admin.site.register(VoiceCall, VoiceCallAdmin)
StarcoderdataPython
3306079
import uuid import requests import requests_mock import simplejson as json from chaoscloud.api import client_session from chaoscloud.api import urls from chaoscloud.api.execution import initialize_execution, publish_execution, \ fetch_execution, publish_event ENDPOINT = "https://console.chaosiq.io" def test_e...
StarcoderdataPython
4817304
import pickle import torch import torch.nn as nn def load_vocab(path): with open(path, 'rb') as inFile: return pickle.load(inFile) def save_vocab(vocab, path): with open(path, 'wb') as output: pickle.dump(vocab, output) def count_parameters(model: nn.Module): return sum(p.numel() for p in model...
StarcoderdataPython
158895
# Lists courses=['History','Math','Physics','Compsci'] courses_2=['Football','Basketball'] print("Slicing Examples") print(len(courses)) print(courses) print(courses[-1]) print(courses[0:3]) print(courses[::-1]) print("\nAdd") courses.append('Art') print(courses) print("\nInsert at the beginning") co...
StarcoderdataPython
53741
<filename>tilse/util/sentence_segmentation.py<gh_stars>0 import syntok.segmenter as segmenter def sentence_segmenter(document): sentences = [] for paragraph in segmenter.process(document): for sentence in paragraph: s_sentence = "" for token in sentence: # roughl...
StarcoderdataPython
3308511
<reponame>fga-gpp-mds/2018.1-Cris-Down from django.db import models from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import Group, Permission, ContentType from django.db.models import Q from django.core.exceptions import ValidationError from django.db.models.signals import post_de...
StarcoderdataPython
3219783
<filename>model-optimizer/extensions/middle/GroupNorm_test.py """ Copyright (C) 2018-2021 Intel 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/...
StarcoderdataPython
120531
<filename>src/discord_bot/bot.py from discord import Intents from discord.ext.commands import Bot from . import settings from typing import TYPE_CHECKING if TYPE_CHECKING: from discord.ext.commands import Context def build_bot() -> "Bot[Context]": b = Bot(command_prefix=settings.COMMAND_PREFIX, intents=Inten...
StarcoderdataPython
3851
<gh_stars>0 # Copyright 2018 The Forseti Security Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
StarcoderdataPython
1745317
<reponame>xingjianleng/cogent3 #!/usr/bin/env python """Parser for PSL format (default output by blat). Compatible with blat v.34 """ from cogent3.util.table import Table __author__ = "<NAME>, <NAME>" __copyright__ = "Copyright 2007-2022, The Cogent Project" __credits__ = ["<NAME>", "<NAME>", "<NAME>", "<NAME>"] ...
StarcoderdataPython
1767112
<reponame>Dylan0888/csws-week3 #for x in range (1,101): # print(x) #print("These are the numbers!") fours =[ i**4 for i in range (1,13)] print (fours) print ("These are the numbers 1 - 12 to the power of 4" ) number = int(input(" pick a number to multiply by 10: ")) numberOne = number * 10 print(numberOne)
StarcoderdataPython
4841352
<reponame>musen-rse/examples_python from abc import ABC, abstractmethod from typing import List from core.charts_abc import Chart class Sensor(ABC): def __init__(self) -> None: self.charts: List[Chart] = [] def add_chart(self, chart: Chart) -> None: self.charts.append(chart) def remove_...
StarcoderdataPython
134385
import torch.nn as nn from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence import torch from layers.attention import MultiHeadedAttention from layers.rezero import RezeroConnection class Encoder(nn.Module): def __init__(self, src_embed_size, ans_embed_size, hidden_size, dropout, bidir, n_head): ...
StarcoderdataPython
1766949
from .lims_autosamplerMethod_postgresql_models import * from SBaaS_base.sbaas_base_query_update import sbaas_base_query_update from SBaaS_base.sbaas_base_query_drop import sbaas_base_query_drop from SBaaS_base.sbaas_base_query_initialize import sbaas_base_query_initialize from SBaaS_base.sbaas_base_query_insert impor...
StarcoderdataPython
4819259
""" query widgets """ # Copyright (c) 2020 ipyradiant contributors. # Distributed under the terms of the Modified BSD License. __all__ = ["QueryWidget"] from .query_widget import QueryWidget
StarcoderdataPython
1631874
<gh_stars>1-10 from django.apps import AppConfig class LatestTweetsConfig(AppConfig): name = "latest_tweets" label = "latest_tweets" verbose_name = "Latest Tweets" default_auto_field = "django.db.models.AutoField"
StarcoderdataPython
3399712
<gh_stars>0 from .statsig_environment_tier import StatsigEnvironmentTier import typing class StatsigOptions: """An object of properties for initializing the sdk with additional parameters""" def __init__(self, api: str="https://api.statsig.com/v1/", tier: 'typing.Any'=None): self._environment = None ...
StarcoderdataPython
134880
<filename>eulxml/xmlmap/teimap.py # file eulxml/xmlmap/teimap.py # # Copyright 2010,2011 Emory University Libraries # # 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://w...
StarcoderdataPython
186848
# -*- coding: utf-8 -*- # IPC: A python library for interprocess communication via standard streams. # # $Id$ # # License: MIT # Copyright 2015-2017 <NAME> (https://github.com/UncleRus) # Copyright 2017 <NAME> (https://github.com/oleg-golovanov) # # Permission is hereby granted, free of charge, to any person obtaining...
StarcoderdataPython
3352946
import json import subprocess from pathlib import Path import luigi from luigi.util import inherits, requires from luigi.contrib.sqla import SQLAlchemyTarget import pipeline.models.db_manager from ..tools import tools from .targets import TargetList from .helpers import meets_requirements, is_inscope from ..models.ta...
StarcoderdataPython
142923
import unittest from datetime import date from pyramid import testing from whoahqa.utils import format_date_for_locale class TestLocaleDate(unittest.TestCase): def test_returns_date_string_as_per_request_locale(self): request = testing.DummyRequest() formatted_date = format_date_for_locale( ...
StarcoderdataPython
3242751
<gh_stars>1-10 #!/usr/bin/python # Filename: verilog_port_analysis.py class VerilogPort: def __init__(self): self.name = '' self.ins_name = '' self.style = '' self.axis_last = False pass def print(self): print(self.style+':'+self.name+','+str(self.width)+','+self...
StarcoderdataPython
3380606
#!/usr/bin/env python """ Template for making scripts to run from the command line Copyright (C) CSIRO 2020 """ import pylab import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import os import sys import logging __author__ = "<NAME> <<EMAIL>>" def _main(): from argparse import ArgumentPa...
StarcoderdataPython
1642532
<gh_stars>0 #!/usr/bin/env python3 #---------------------------------------------------------------------------- # Copyright (c) 2018 FIRST. All Rights Reserved. # Open Source Software - may be modified and shared by FRC teams. The code # must be accompanied by the FIRST BSD license file in the root directory of # the ...
StarcoderdataPython
1737725
<reponame>BarracudaPff/code-golf-data-pythpn try: pass except ImportError: sys.exit("install SimpleWebSocketServer") request_queue = queue.Queue() class ElectrumWebSocket(WebSocket): def handleMessage(self): assert self.data[0:3] == "id:" util.print_error("message received", self.data) request_id = self.data[3...
StarcoderdataPython
4831201
{ "includes": [ "../common.gypi" ], "targets": [ { "target_name": "libgdal_ogr_idrisi_frmt", "type": "static_library", "sources": [ "../gdal/ogr/ogrsf_frmts/idrisi/ogridrisidatasource.cpp", "../gdal/ogr/ogrsf_frmts/idrisi/ogridrisilayer.cpp", "../gdal/ogr/ogrsf_frmts/idrisi/ogridrisidriver.c...
StarcoderdataPython
4829611
"""Tasks related to the Tamr auxiliary service DF-connect""" from . import client from . import jdbc_info __all__ = ["client", "jdbc_info"]
StarcoderdataPython
60435
from flask import Flask from flask import request from flask import Response from handling import Handler import json app = Flask(__name__) INDEX_NAME = 'contacts' PORT = 9200 handler = Handler(INDEX_NAME, port = PORT, wipe_index = True) @app.route('/contact', methods=['GET','POST']) def contact_without_name(): ...
StarcoderdataPython
3320750
from . import _simplecoremidi as cfuncs class MIDIInput(object): def __init__(self, input_name=None): if not input_name: self._input = None else: self._input = cfuncs.find_input(input_name) def recv(self): return cfuncs.recv_midi_from_input(self._input) @s...
StarcoderdataPython
1771374
<reponame>azatoth/telepresence """ Test environment variable being set. This module will indicate success it will exit with code 113. """ import os import sys from traceback import print_exception def handle_error(type, value, traceback): print_exception(type, value, traceback, file=sys.stderr) raise System...
StarcoderdataPython
1765026
<filename>run.py<gh_stars>1-10 #!/usr/bin/python """ Top level script. Calls other functions that generate datasets that this script then creates in HDX. """ import logging from os.path import expanduser, join from hdx.facades.simple import facade from hdx.api.configuration import Configuration from hdx.utilities.dow...
StarcoderdataPython
1740879
# encoding=utf-8 import os from flask import Flask from flask import render_template from flask import jsonify from flask import request import re from Subject import Subject from constants import SubjectType, Gender, VisitorPurpose from flask.ext.sqlalchemy import SQLAlchemy from flask_script import Shell, Manager ...
StarcoderdataPython
1706649
def getRuleName(rule): adj, color, _ = rule.strip().split(' ') return '{} {}'.format(adj, color) def generateNode(rule): pRule, cRules = list(map(lambda x: x.strip(), rule.split('contain'))) parent = getRuleName(pRule) cList = cRules.split(', ') children = [] for c in cList: if ...
StarcoderdataPython
3205819
<reponame>Schevo/schevo """Field metadata changing tests.""" # Copyright (c) 2001-2009 ElevenCraft Inc. # See LICENSE for details. from schevo.test import CreatesSchema from schevo.field import not_expensive, not_fget, not_hidden class BaseFieldMetadataChanged(CreatesSchema): body = ''' class Foo(E.Entity...
StarcoderdataPython
4823480
from numpy import random map_x_size = 10 map_list = [0 for i in range(map_x_size)] class Character: def __init__(self,level, HP, atk, speed, attack_speed, critical_hit_rate, evasion_rate, exp): print("Character Production") self.result = 0 self.level = level self.HP = HP se...
StarcoderdataPython
190694
<gh_stars>0 '''class Pessoa(object): def __init__(self, nome, idade, peso): self.nome = nome self.idade = idade self.peso = peso def andar(self): print('anda') pessoa1 = Pessoa("Juliana", 23, 75) pessoa2 = Pessoa("Carlos", 39, 72) print(pessoa1.nome) pessoa1.andar() def fatori...
StarcoderdataPython
1607286
<reponame>anil-allipilli/Sponsor<filename>accounts/migrations/0005_sponser_mysponsees.py # Generated by Django 3.0 on 2020-12-02 19:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('accounts', '0004_auto_20201111_1945'), ] operations = [ ...
StarcoderdataPython
105725
<gh_stars>0 #!/usr/bin/env python3 import sys with open(sys.argv[1]) as file: for line in (line.rstrip() for line in file): values = line.split() history = set() duplicates = [] for i in reversed(values): if i not in history: history.add(i) elif i not in duplicates: dup...
StarcoderdataPython
180858
<reponame>wangrui1121/huaweicloud-sdk-python # Copyright 2018 Huawei Technologies Co.,Ltd. # # 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
56556
""" Intialize the Pygate application """ from flask import Flask from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config.from_object("config") db = SQLAlchemy(app) from pygate import routes, models
StarcoderdataPython
125243
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('products', '0002_product_value'), ('orders', '0003_auto_20141225_2344'), ] operations = [ migrations.CreateModel( ...
StarcoderdataPython
4827933
from Crypto.Cipher import AES import binascii keystring = '00000000000000000000000000000000' iostoken = '107005ed3f3845aea7696d838df8389385b88224e4696b2e78be02cfc83d4d770143db63ee66b0cdff9f69917680151e' key = bytes.fromhex(keystring) cipher = AES.new(key, AES.MODE_ECB) token = cipher.decrypt(bytes.fromhex(iostoken[:64]...
StarcoderdataPython
1790100
"""Module that contains the enumerates for the image controls. Enumerates: Rule. """ from enum import Enum class Control(Enum): """Enumerate of controls""" pixel_size = 'pixel_size' bands_len = 'bands_len' dig_level = 'dig_level' rad_balance = 'rad_balance' srid = 'srid' nodata = 'nodata' aall = 'a...
StarcoderdataPython
3304896
<gh_stars>1-10 # @l2g 1898 python3 # [1898] Maximum Number of Removable Characters # Difficulty: Medium # https://leetcode.com/problems/maximum-number-of-removable-characters # # You are given two strings s and p where p is a subsequence of s. # You are also given a distinct 0-indexed integer array removable containing...
StarcoderdataPython
1633831
import SimpleITK as sitk import numpy as np import os import paths import csv import math from scipy.io import loadmat from skimage.measure import regionprops, marching_cubes_classic, mesh_surface_area def divide_hcp(connectivity_matrix, hcp_connectivity): ''' divide the connectivity matrix by the hcp matrix''' ...
StarcoderdataPython
1681516
<gh_stars>1000+ # Copyright 2021 Huawei Technologies Co., Ltd # # 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 ...
StarcoderdataPython
145779
import structlog log = structlog.getLogger(__name__) class AuthManager(object): '''Manager responsible for authentication. Manager uses API instance ``api`` for basic auth operations and provides additional logic on top. :param `opentaxii.auth.api.OpenTAXIIAuthAPI` api: instance of Auth API...
StarcoderdataPython
4832637
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
StarcoderdataPython
3257796
from pyopencga.rest_clients._parent_rest_clients import _ParentRestClient class Tool(_ParentRestClient): """ This class contains methods for the Analysis - Tool webservices """ def __init__(self, configuration, session_id=None, login_handler=None, *args, **kwargs): _category = 'analysis/tool' ...
StarcoderdataPython
1615806
from contextlib import contextmanager from copy import deepcopy from functools import partial import sys import warnings import numpy as np from numpy.testing import assert_equal import pytest from numpy.testing import assert_allclose from expyfun import ExperimentController, visual, _experiment_controller from expyf...
StarcoderdataPython
47980
<gh_stars>10-100 from setuptools import setup, find_packages from dnevnik import __version__ with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( name='dnevnik-mos-ru', version=__version__, description="This package is kind of wrapper for dnevnik.mos.ru API service"...
StarcoderdataPython
148623
import sublime import sublime_plugin class NodejsAutocompleteCommand(sublime_plugin.TextCommand): def run(self, edit): view = self.view view_sel = view.sel() if not view_sel: return pos = view_sel[0].begin() self.view.insert(edit, pos, ".doSth()")
StarcoderdataPython
139616
<reponame>Ayushk4/tsat import time import logging import os class Speedometer(object): def __init__(self, batch_size, frequent=50, batches_per_epoch=None, epochs=None): self.batch_size = batch_size self.frequent = frequent self.batches_per_epoch = batches_per_epoch ...
StarcoderdataPython
189140
<reponame>capalmer1013/musical-compass import os import matplotlib.pyplot as plt from flask import Flask, session, request, redirect, send_file from flask_session import Session import pyoauth2 from . import helpers app = Flask(__name__) app.config.from_object("musical_compass.config") Session(app) api_url = 'https:...
StarcoderdataPython
3350696
#!/usr/bin/env python import pickle import os import argparse import numpy as np import pandas as pd # load packages required for analysis import statsmodels.api as sm import statsmodels as sm import matplotlib import matplotlib.pyplot as plt import seaborn as sns from scipy import stats from trasig.utils import st...
StarcoderdataPython
3353883
# ============================================================================= # Fog Clustering Unit Tests Utilities # ============================================================================= class Clusters(object): def __init__(self, clusters): self.groups = set(tuple(sorted(values, key=str)) for v...
StarcoderdataPython
1747014
<reponame>UriyaBA/Minesweeper import json import pygame from drawable import Drawable class Tile(Drawable): COLOR_UNREVEALED = (193, 192, 193) COLOR_REVEALED = (193, 192, 193) COLOR_REVEALED_MINE = (255, 192, 193) MINE_DANGER = 9 # Load indicative 'danger level' colors from external json file ...
StarcoderdataPython
87803
from importlib import import_module from os import environ import typing as t from . import global_settings from ..errors.server import SettingsFileNotFoundError, ImproperlyConfigured from ..errors.misc import DataTypeMismatchError __all__ = ("get_settings_module", "settings") ENVIRONMENT_VARIABLE = "NAVYCUT_SETTINGS...
StarcoderdataPython
1609809
<reponame>autodidacticon/quickstart-amazon-eks import logging from crhelper import CfnResource from time import sleep import json import boto3 from semantic_version import Version from random import choice execution_trust_policy = { 'Version': '2012-10-17', 'Statement': [ { 'Effect': 'Allow...
StarcoderdataPython
86148
from django.test import TestCase from explorer.actions import generate_report_action from explorer.tests.factories import SimpleQueryFactory from explorer import app_settings from explorer.utils import passes_blacklist, schema_info, param, swap_params, extract_params, shared_dict_update, EXPLORER_PARAM_TOKEN, execute_q...
StarcoderdataPython
3292138
# project/db_migrate.py from views import db from _config import DATABASE_PATH import sqlite3 #from datetime import datetime # with sqlite3.connect(DATABASE_PATH) as connection: # c = connection.cursor() # c.execute("""ALTER TABLE tasks RENAME TO old_tasks""") # db.create_all() # c.execute("""SELECT name, due_da...
StarcoderdataPython
3270431
import boto3 client = boto3.client('sqs') response = client.receive_message( QueueUrl='https://sqs.eu-west-1.amazonaws.com/164968468391/gymchecker', AttributeNames=[ 'All' ], MessageAttributeNames=[ 'All', ], MaxNumberOfMessages=1, VisibilityTimeout=123, WaitTimeSeconds...
StarcoderdataPython
1713377
import sys class OmasError(): """Class for errors""" count = 0 errorList = [] def __init__(self): pass def add(self,typeError,message,line): self.count+=1 logString = typeError+" "+message+" "+"on line"+" "+str(line) self.errorList.append({"logString":logString,"line":line}) #print(logString) #sys...
StarcoderdataPython
81286
import json import os.path class Scheme(dict): """Represents all of the data associated with a given scheme. In addition to storing whether or not a scheme is roman, :class:`Scheme` partitions a scheme's characters into important functional groups. :class:`Scheme` is just a subclass of :class:`dict...
StarcoderdataPython
3206537
from .custom_logger import BackgroundCustomLogger from . import api __version__ = '1.3.2' logger = BackgroundCustomLogger() __all__ = [ BackgroundCustomLogger.__name__, 'logger', 'api' ]
StarcoderdataPython
1680748
# -*- coding: utf-8 -*- ''' salt.serializers.msgpack ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Implements MsgPack serializer. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import copy import logging # Import Salt Libs import salt.utils.msgpack from salt.serializer...
StarcoderdataPython
1734573
<filename>dist/ba_root/mods/chatHandle/ChatCommands/commands/Cheats.py from .Handlers import handlemsg, handlemsg_all, clientid_to_myself import ba, _ba Commands = ['kill', 'heal', 'curse', 'sleep', 'superpunch', 'gloves', 'shield', 'freeze', 'unfreeze', 'godmode'] CommandAliases = ['die', 'heath', 'cur', 'sp', 'pun...
StarcoderdataPython