id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
182835
# Copyright (C) 2015-2016 The bitcoin-blockchain-parser developers # # This file is part of bitcoin-blockchain-parser. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of bitcoin-blockchain-parser, including this file, may be copied, # modif...
StarcoderdataPython
1661952
from can_tools.scrapers.official.AZ.counties.maricopa_vaccine import ( ArizonaMaricopaVaccine, )
StarcoderdataPython
56703
<reponame>MyDataShare/access-gateway<gh_stars>1-10 from unittest import main from .helpers import api, test_base text = """ Nocturne Ruislinnun laulu korvissani, tähkäpäiden päällä täysi kuu; kesä-yön on onni omanani, kaskisavuun laaksot verhouu. En ma iloitse, en sure, huokaa; mutta met...
StarcoderdataPython
97880
from collections import Counter def day6(n_days: int) -> int: with open("input.txt") as f: fishes = map(int, f.readline().split(",")) n_fish_per_day = Counter() for f in fishes: n_fish_per_day[f] += 1 # simulate days for _ in range(n_days): new_n_fish_per_day = {} ...
StarcoderdataPython
42394
<filename>configs/_base_/explain/count_concepts.py concept_detector_cfg = dict( quantile_threshold=0.99, with_bboxes=True, count_disjoint=True, ) target_layer = 'layer3.5'
StarcoderdataPython
3320769
<gh_stars>10-100 # coding: utf-8 """json读写插件 """ import re import types import ujson import requests from girlfriend.util.lang import args2fields from girlfriend.util.resource import HTTP_SCHEMA from girlfriend.plugin.data import ( AbstractDataReader, AbstractDataWriter ) from girlfriend.exception import Inva...
StarcoderdataPython
107071
<gh_stars>0 # Generated by Django 3.0.6 on 2020-06-03 08:23 from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('course', '0006_auto_20200601_1325'), ] ...
StarcoderdataPython
3243855
<gh_stars>10-100 # -*- coding: utf-8 -*- """Module containing the logic for the lambda nuke entry-points."""
StarcoderdataPython
115644
<reponame>siemens/python-cybox # Copyright (c) 2014, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. import cybox import cybox.bindings.cybox_core as core_binding from cybox.common import VocabString from cybox.core import Object class AssociationType(VocabString): _XSI_TYPE = '...
StarcoderdataPython
3354700
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Nov 3 19:37:10 2017 @author: dalonlobo """ import pandas as pd import numpy as np import matplotlib.pyplot as plt dataset = pd.read_csv('50_Startups.csv') X = dataset.iloc[:, :-1].values y = dataset.iloc[:, -1].values from sklearn.preprocessing impo...
StarcoderdataPython
3310483
<reponame>gustavs408650/looker_sdk_30 from __future__ import absolute_import # flake8: noqa # import apis into api package from looker_client_30.api.api_auth_api import ApiAuthApi from looker_client_30.api.auth_api import AuthApi from looker_client_30.api.config_api import ConfigApi from looker_client_30.api.connecti...
StarcoderdataPython
38068
import requests import functools from django.shortcuts import get_object_or_404 from db_query.models import PersistentQuery def apply_middleware(raw_data, exec_sql_fn, *args, **kw_args): return adapt_bundle(raw_data[0], exec_sql_fn) def adapt_bundle(raw_data, exec_sql_fn): return { "id": raw_data.ge...
StarcoderdataPython
57051
import gtfs_kit from representation.gtfs_metadata import GtfsMetadata from representation.gtfs_representation import GtfsRepresentation from representation.dataset_infos import DatasetInfos from requests.exceptions import MissingSchema from pandas.errors import ParserError GTFS_TYPE = "GTFS" GBFS_TYPE = "GBFS" def b...
StarcoderdataPython
3378994
<filename>homeworks/aleksey_gukov/lesson13/level01.py<gh_stars>0 def get_headers(http_resp): spisok = http_resp.split("\n") del spisok[0] del spisok[spisok.index("") :] slovar = {} for chast in spisok: head = chast.split(": ") slovar[head[0]] = head[1] return slovar
StarcoderdataPython
50430
<filename>koapy/cli/utils/credential.py import os import click from koapy.config import ( config, config_from_dict, default_user_config_path, save_config, user_config, ) def prompt_credential(): credential = config.get("koapy.backend.kiwoom_open_api_plus.credential") default_user_id = c...
StarcoderdataPython
3237994
<filename>hydrus/client/gui/search/ClientGUIPredicatesOR.py import typing from qtpy import QtWidgets as QW from hydrus.core import HydrusData from hydrus.core import HydrusExceptions from hydrus.client import ClientConstants as CC from hydrus.client import ClientSearch from hydrus.client.gui import QtPorting as QP ...
StarcoderdataPython
1719872
<filename>optapy-core/tests/test_user_error.py<gh_stars>10-100 import optapy import optapy.score import optapy.config import optapy.constraint from optapy.types import Duration import pytest import re @optapy.planning_entity class Entity: def __init__(self, value=None): self.value = value @optapy.pla...
StarcoderdataPython
151464
import argparse import logging import os import copy from collections import defaultdict from typing import List import numpy as np import torch from sklearn import metrics from torch.nn.utils.rnn import pad_sequence from torch.utils.data.dataloader import DataLoader from training.models import RNNClassifier from opera...
StarcoderdataPython
111532
<filename>crawler_from_scratch/start.py # AUTOGENERATED! DO NOT EDIT! File to edit: 00_Getting_Started.ipynb (unless otherwise specified). __all__ = []
StarcoderdataPython
1770421
import numpy as np from thyme import * from thyme.parsers.extxyz import write import sys if __name__ == "__main__": # trjs = from_file(sys.argv[1]) # trjs.save(sys.argv[2]+".pickle") # trjs.save(sys.argv[2]+"_padded_mat.npz") trj = Trajectory.from_file( sys.argv[1], update_dict={ ...
StarcoderdataPython
25192
<filename>tests/fdb.py<gh_stars>0 import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library from datetime import datetime import time import paho.mqtt.client as mqtt def button_callback(channel): print(str(datetime.now()) + "Button was pushed!") trigger() time.sleep(2) # The callback for when the client...
StarcoderdataPython
155871
from __future__ import division from scipy.stats import norm from pandas import read_excel import numpy as np # Transform to normal distribution # def allnorm(x, y): sample = len(x) # Estimate norm parameters # phat1 = norm.fit(x, loc=0, scale=1) meanx = phat1[0] sigmax = phat1[1] phat2 = n...
StarcoderdataPython
3397124
<reponame>sns-sdks/python-twitter-premium from dataclasses import dataclass, field from typing import Optional, List from .base import BaseModel @dataclass class Hashtag(BaseModel): """ A class representing hashtag object. Refer: https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/ent...
StarcoderdataPython
1770223
<gh_stars>0 # Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed # under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance wit...
StarcoderdataPython
3392585
<filename>datetime2/modern.py # ISO calendar and Internet time # Copyright (c) 2013-2022 <NAME> # # All rights reserved. # # 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 ...
StarcoderdataPython
1687466
from django.contrib import admin from spinach import Batch from . import models from .tasks import tasks @admin.register(models.Feed) class FeedAdmin(admin.ModelAdmin): list_display = ('name', 'domain', 'last_fetched_at', 'last_failure') actions = ['sync'] def sync(self, request, queryset): bat...
StarcoderdataPython
175721
# -*- coding: utf-8 -*- # Spider for 91 buddha # # See documentation in: # https://doc.scrapy.org/en/latest/topics/spiders.html import scrapy import logging import random from buddha_item import BuddhaItem from utils.data_store import DataStore import math import time date_string = time.strftime("%Y_%m_%d", time.l...
StarcoderdataPython
185765
<gh_stars>1-10 import pathlib import shutil import tempfile from pymongo import MongoClient from ted_sws import config from ted_sws.core.model.manifestation import XMLManifestation from ted_sws.core.model.notice import Notice from ted_sws.data_manager.adapters.mapping_suite_repository import TRANSFORM_PACKAGE_NAME, V...
StarcoderdataPython
1749399
<reponame>tirkarthi/odin-ai from __future__ import absolute_import, division, print_function import os import time import numpy as np import seaborn as sns import tensorflow as tf import tensorflow_probability as tfp from matplotlib import pyplot as plt from tensorflow import keras from odin import visual as vs from...
StarcoderdataPython
3274539
# coding: utf-8 from __future__ import unicode_literals import unittest import responses from admitad.items import Coupons, CouponsForWebsite, CouponsCategories from admitad.tests.base import BaseTestCase class CouponsTestCase(BaseTestCase): def test_get_coupons_request(self): with responses.RequestsMo...
StarcoderdataPython
3256127
#!/usr/bin/env python import optparse from rq import use_connection, Queue from rq import dummy def parse_args(): parser = optparse.OptionParser() parser.add_option('-n', '--count', type='int', dest='count', default=1) opts, args = parser.parse_args() return (opts, args, parser) def main(): impor...
StarcoderdataPython
1643969
import json, os, signal, time, traceback,shutil import curses import cbpro import multiprocessing from pygotrader import arguments,config, order_handler, pygo_order_book, tui, algorithm_handler from pkg_resources import Requirement, resource_filename #from profiling.tracing import TracingProfiler class CustomExit(Exc...
StarcoderdataPython
140106
""" Encapsulates external dependencies to retrieve hardware metadata """ import logging from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Dict, Iterable, List, Optional from codecarbon.core.gpu import get_gpu_details from codecarbon.core.units import Power logger = logging.getL...
StarcoderdataPython
3282083
<reponame>Samteymoori/pepper from build import PEPPER from collections import defaultdict def pileup_from_reads(reference, start_pos, end_pos, reads): longest_insert_count = defaultdict(int) insert_dict = defaultdict(lambda: defaultdict(int)) base_dict = defaultdict(lambda: defaultdict(int)) read_sta...
StarcoderdataPython
3232804
<reponame>thismachinekillszombies/game_machine from .vector_sprite import VectorSprite from pygame import Rect class Rectangle(VectorSprite) : def __init__(self, coords, size, visible = True, interactive = True, line_colour = (0, 0, 0, 255), line_width = 1, ...
StarcoderdataPython
4821033
<reponame>IanShoe/serverless-leo<gh_stars>1-10 class Config: LOG_NAME = 'leosdk' LOG_LEVEL = 'DEBUG' LOG_FORMAT = '%(asctime)s %(name)s [%(levelname)s] %(message)s' BUS_REGION = 'us-west-2' AWS_PROFILE = 'leo_test' WRITER = 'STREAM' # WRITER = 'STORAGE' # WRITER = 'BATCH' class DevBus(...
StarcoderdataPython
3215911
<filename>Python/libraries/recognizers-date-time/recognizers_date_time/resources/english_date_time.py # ------------------------------------------------------------------------------ # <auto-generated> # This code was generated by a tool. # Changes to this file may cause incorrect behavior and will be lost if #...
StarcoderdataPython
1693396
import bentoml import pandas as pd import numpy as np from bentoml.artifact import PickleArtifact # from bentoml.adapters import DataframeInput from bentoml.handlers import DataframeHandler from bentoml.handlers import JsonHandler @bentoml.ver(1, 0) @bentoml.artifacts([ PickleArtifact("knn"), PickleArtifact("...
StarcoderdataPython
3330898
<filename>random_user_agent.py from enums import OS, Chipset, Browser, Language import random from datetime import date, timedelta, datetime from copy import deepcopy def _random_date(start: datetime.date, end: datetime.date): """Generate a random datetime between `start` and `end`""" return start + t...
StarcoderdataPython
3370016
from foundations_spec import * class DockerTestMixin(object): @let def docker_client(self): import docker return docker.from_env() def _create_temp_directories(self, *directory_names): import tempfile self._temp_directories = {} for directory_name in directory_n...
StarcoderdataPython
3279943
from dataclasses import asdict from aiohttp import web from schematics.exceptions import DataError from asyncpg.exceptions import UniqueViolationError from src import db from src.models.user import User from src.models.paginator import Paginator from src.models.game import State from src.encrypt import encrypt_jwt, i...
StarcoderdataPython
1765494
def error(text): print("\033[31m" + text + "\033[0m") def warning(text): print("\033[33m" + text + "\033[0m") def info(text): print("\033[32m" + text + "\033[0m")
StarcoderdataPython
3376513
<gh_stars>1-10 from sqlalchemy import Column, String from app.db.base_class import Base class User(Base): username = Column(String, primary_key=True, index=True) full_name = Column(String) hashed_password = Column(String)
StarcoderdataPython
1699172
#!/usr/bin/env python # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Tests for scripts/master/master_gen.py.""" import os import tempfile import unittest # This adjusts sys.path, so it must be impor...
StarcoderdataPython
168925
# --*-- coding : utf-8 --*-- """Author: Trinity Core Team MIT License Copyright (c) 2018 Trinity Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation...
StarcoderdataPython
1621542
<filename>crisiscleanup/calls/migrations/0017_AdditionalModelUpdates.py # -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2018-03-07 04:23 from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ...
StarcoderdataPython
1670605
#!/usr/bin/env python 3 ############################################################################################ # # # Program purpose: Select the odd items of a list. # # Program...
StarcoderdataPython
1765170
<reponame>jensgk/optbinning """ Optimal binning algorithm 2D. """ # <NAME> <<EMAIL>> # Copyright (C) 2021 import matplotlib.pyplot as plt import numpy as np import pandas as pd from mpl_toolkits.axes_grid1 import make_axes_locatable from ...formatting import dataframe_to_string from ..binning_statistics import _che...
StarcoderdataPython
180766
from collections import namedtuple from collections import defaultdict from biicode.common.model.brl.cell_name import CellName from biicode.common.model.symbolic.block_version import BlockVersion from biicode.common.utils.serializer import DictDeserializer, SetDeserializer from biicode.common.model.brl.block_cell_name...
StarcoderdataPython
1647115
import os from gppylib.commands.base import Command, REMOTE from gppylib.commands.unix import getLocalHostname gphome = os.environ.get('GPHOME') def get_command(local, command, hostname): if local: cmd = Command(hostname, cmdStr=command) else: cmd = Command(hostname, cmdStr=command, ctxt=REMOT...
StarcoderdataPython
41450
""" ________ ___ __ ________ ________ ___ ___ ________ _______ ________ |\ ____\|\ \ |\ \|\ __ \|\ __ \ |\ \|\ \|\ ____\|\ ___ \ |\ __ \ \ \ \___|\ \ \ \ \ \ \ \|\ \ \ \|\ \ \ \ \\\ \ \ \___|\ \ __/|\ \ \|\ \ \ \_____ \ \ \ __\ \ \ \ __ \ \ ...
StarcoderdataPython
196696
<reponame>acyrl/edward2 # coding=utf-8 # Copyright 2020 The Edward2 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 requ...
StarcoderdataPython
1675004
<filename>May 2019/bubble_sort.py numbers = [2, 4, 9, 1, 7, 6, 5, 8, 3] def bubble_sort(array): search_length = len(array)-1 swapped = True #Keeps iterating, comparing and swapping until a complete loop without swapping is detected while swapped == True: swapped = False for index in range(search_lengt...
StarcoderdataPython
1606368
<filename>data/split_coco.py import json import numpy as np with open("data/widgets/annotations/all.json") as f: all_annotations = json.load(f) samples_count = len(all_annotations["annotations"]) validation_ids = np.random.choice(samples_count, size=62, replace=False) valid_dict = all_annotations.copy() valid_dic...
StarcoderdataPython
1726390
""" Views (JSON objects) for Annotator storage backend """ import datetime import jwt import logging import os from collections import OrderedDict import django_filters.rest_framework from django.http import HttpResponse, JsonResponse from django.contrib.auth.models import User from django.contrib.auth.decorators impo...
StarcoderdataPython
94391
from django.core.urlresolvers import resolve from django.test import TestCase from django.http import HttpRequest, QueryDict from minimal_django import index, urlpatterns class HomePageTest(TestCase): def test_root_url_resolves_to_home_page_view(self): found = resolve('/', urlconf = urlpatterns) se...
StarcoderdataPython
3363204
<reponame>achimmihca/DedoMouse<filename>src/gui/VideoCaptureThread.py #!/usr/bin/env python import time from typing import Any import logging import cv2 from PySide6.QtCore import QThread from PySide6.QtGui import QImage, QPixmap from PySide6.QtWidgets import QLabel from common.Config import Config from common.Vector i...
StarcoderdataPython
1778775
<filename>UML2ER/contracts/HContract06_CompleteLHS.py<gh_stars>1-10 from core.himesis import Himesis, HimesisPreConditionPatternLHS import uuid class HContract06_CompleteLHS(HimesisPreConditionPatternLHS): def __init__(self): """ Creates the himesis graph representing the AToM3 model HContract06_CompleteLHS """...
StarcoderdataPython
1693575
from .relationship import Relationship from .base import BaseRelationship
StarcoderdataPython
84145
<filename>run_in_cron.py import run run.job()
StarcoderdataPython
3368142
<reponame>experiencedft/defisaver-sim from modules.readConfig import readConfig from modules.optimize import optimizeRatioContinuous underlying_return, time_period, volatility = readConfig("Continuous limit optimization parameters") optimal_ratio, optimal_return = optimizeRatioContinuous(underlying_return, time_peri...
StarcoderdataPython
1760874
<reponame>marissawalker/spectre<filename>tests/Unit/Evolution/Systems/RelativisticEuler/Valencia/TestFunctions.py # Distributed under the MIT License. # See LICENSE.txt for details. import numpy as np # Functions for testing Characteristics.cpp def characteristic_speeds(lapse, shift, spatial_velocity, spatial_veloci...
StarcoderdataPython
176287
# -*- coding: utf-8 -*- import sys from PySide2 import QtWidgets from PySide2.QtTest import QTest from numpy import pi from Tests.GUI import gui_option # Set unit as [m] from pyleecan.Classes.LamSlotMag import LamSlotMag from pyleecan.Classes.SlotCirc import SlotCirc from pyleecan.GUI.Dialog.DMachineSetup.SMSlot.WSl...
StarcoderdataPython
4819742
""" Parse Velodyne VLP-16 data """ import struct import math from osgar.node import Node LASER_ANGLES = [-15, 1, -13, 3, -11, 5, -9, 7, -7, 9, -5, 11, -3, 13, -1, 15] NUM_LASERS = 16 def parse_packet(data, offset_step=100): assert len(data) == 1206, len(data) assert offset_step % 100 == 0, offset_step # ...
StarcoderdataPython
4833081
<gh_stars>0 import json from channels.generic.websocket import AsyncWebsocketConsumer from channels.db import database_sync_to_async from .models import Chat, ChatRoom class ChatConsumer(AsyncWebsocketConsumer): async def connect(self): self.room_name = self.scope['url_route']['kwargs']['room_name'] self.room_gro...
StarcoderdataPython
3338103
<reponame>AlexScheller/dark-chess from flask import Blueprint main = Blueprint('main', __name__) from dark_chess_app.modules.main import routes
StarcoderdataPython
4823786
from django.contrib import admin from .models import Profile, Tweet, ScheduledTweet admin.site.register(Profile) admin.site.register(Tweet) admin.site.register(ScheduledTweet)
StarcoderdataPython
128439
<filename>models/__init__.py from .gazeflow import Glow
StarcoderdataPython
93036
<gh_stars>0 """ models.py """ import uuid from django.contrib.auth.models import AbstractUser from django.db import models from django.utils.translation import ugettext_lazy as _ from .managers import AppUserManager def user_directory_path(instance, filename): # file will be uploaded to MEDIA_ROOT/user_id/<filena...
StarcoderdataPython
1703030
<reponame>parikshitgupta1/leetcode class Solution(object): def leastInterval(self, tasks, n): frequencies = {} output = 0 if n == 0: return len(tasks) for k in tasks: frequencies[k] = frequencies.get(k,0)+1 max_value = max(frequencies.val...
StarcoderdataPython
193465
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- import os import configparser from oger.ctrl.router import Router, PipelineServer from oger.ctrl.run import run as og_run import pandas as pd SETTINGS_FILENAME = 'settings.ini' def create_settings_file(path: str, ont: str = 'ALL') -> None: """ Create...
StarcoderdataPython
3250191
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from __future__ import print_function from __future__ import division from __future__ import absolute_import import datetime import httplib import mock impo...
StarcoderdataPython
3360417
<gh_stars>1-10 from unittest.mock import Mock, patch from weakref import ref import pytest try: from django.db import models # from parasolr.django.indexing import ModelIndexable from parasolr.django.signals import IndexableSignalHandler from parasolr.django.tests import test_models except ImportError...
StarcoderdataPython
1785094
from flask import Blueprint, request, jsonify, session, render_template from flask_login import login_required api = Blueprint('api', __name__) @api.route('/articles', methods=['GET']) def get_all_articles(): pass @api.route('/article', methods=['POST']) def create_article(): pass @api.route('/article/<s...
StarcoderdataPython
133188
import sys import ctypes_scanner pidint = int(sys.argv[1]) toto = ctypes_scanner.GetRegexMatches(pidint,"http://[a-zA-Z_0-9\.]*") print(toto) print(len(toto))
StarcoderdataPython
1740609
<reponame>genkosta/social-network # Generated by Django 2.0.6 on 2018-06-26 08:38 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import social_network.core.models class Migration(migrations.Migration): dependencies = [ migrations.swappable_depe...
StarcoderdataPython
162807
from ..utils.error import Error class Validator(object): def __init__(self): pass def validate(self, model): self.validate_php_functional(model) @staticmethod def validate_php_functional(model): for cls in model.classes: for member in cls.members: ...
StarcoderdataPython
3272574
# Methods to help parse like for private keys to servers and safes. # Used in Bot.py files to read in the user's key-values. from .globals import * from utils.Keychain import Keychain def parseKeychainFromFile(filename, folder="keys"): """ Parses in the bot's private information into a dictionary of {key:val...
StarcoderdataPython
4812263
<gh_stars>0 ### HELPERS ### def to_dec(bin, val=0): if len(bin) == 0: return val return to_dec(bin[1:], val+(int(bin[0])*2**(len(bin)-1))) #print(to_dec("0")) # 0 #print(to_dec("1")) # 1 #print(to_dec("10110")) # 22 #print(to_dec("01001")) # 9 ### SOL ### f = open("p1.txt", "r") bits = f.readlines(...
StarcoderdataPython
144524
# -*- coding: utf-8 -*- from __future__ import print_function import torch import torch.nn.functional as F import spdnn torch.manual_seed(7) input = torch.randn(2,3,3,3, requires_grad=True).cuda() weight = torch.randn(3,3,2,2, requires_grad=True).cuda() print('input shape: ', input.shape) print('weights shape: ', weig...
StarcoderdataPython
112657
''' https://docs.python.org/3/reference/datamodel.html#object.__getitem__ ''' class XXX(object): def __init__(self): self.data = {int(i): str(i) for i in range(3)} def __len__(self): return len(self.data) def __getitem__(self, index): if index >= len(self): raise IndexError r...
StarcoderdataPython
47945
import numpy as np import scipy as sp from scipy.sparse.linalg import LinearOperator, lgmres, gmres import tensornetwork as tn import jax_vumps.numpy_backend.contractions as ct # import jax_vumps.numpy_backend.mps_linalg as mps_linalg def LH_linear_operator(A_L, lR): """ Return, as a LinearOperator, the LH...
StarcoderdataPython
1630145
""" TIFF image parser. Authors: <NAME>, <NAME>, <NAME> Creation date: 30 september 2006 """ from hachoir.parser import Parser from hachoir.field import SeekableFieldSet, RootSeekableFieldSet, Bytes from hachoir.core.endian import LITTLE_ENDIAN, BIG_ENDIAN from hachoir.parser.image.exif import TIFF, IFD def getStrip...
StarcoderdataPython
183277
from apiclient.discovery import build from oauth2client.service_account import ServiceAccountCredentials execfile("config.py") # Core Reporting API def get_core_reporting_api_service(): scope = 'https://www.googleapis.com/auth/analytics.readonly' key_file_location = config['client_secret_file_name'] # ...
StarcoderdataPython
87418
# This file was automatically generated by SWIG (http://www.swig.org). # Version 2.0.4 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import ...
StarcoderdataPython
4804249
<reponame>Mario263/Hacktoberfest_2021 # Python3 code to demonstrate working of # Maximum and Minimum K elements in Tuple # Using sorted() + loop # initializing tuple test_tup = (5, 20, 3, 7, 6, 8) # printing original tuple print("The original tuple is : " + str(test_tup)) # initializing K K = 2 # Maximum and Mi...
StarcoderdataPython
124338
<reponame>dr-guangtou/asap #!/usr/bin/env python """This script will read the dark matter particle table for the SMDPL simulation, and downsample it for our model. """ import os import argparse import numpy as np import pandas as pd S18A_RAND_COLS = [ 'object_id', 'ra', 'dec', 'coord', 'skymap_id', 'tract', 'pa...
StarcoderdataPython
12436
<reponame>qingyunha/boltdb<gh_stars>1-10 import os import unittest import tempfile from boltdb import BoltDB class TestFree(unittest.TestCase): def setUp(self): self.db = BoltDB(tempfile.mktemp()) def tearDown(self): os.unlink(self.db.filename) def test_free(self): with self.db...
StarcoderdataPython
32291
from dissononce.dh import private class PrivateKey(private.PrivateKey): pass
StarcoderdataPython
1706699
<filename>warehouse/legacy/tables.py # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
StarcoderdataPython
1655915
<gh_stars>0 import os import glob import argparse import zipfile import imageio import tqdm import numpy as np import tracker import cv2 def create_gifs(model, anno_path, zip_path, gif_path, dim=(408,360)): z = zipfile.ZipFile(os.path.join(zip_path)) names = [name for name in z.namelist() if ...
StarcoderdataPython
1727631
<gh_stars>0 #Importing modules import pandas as pd import json from datetime import datetime from kafka import KafkaConsumer from pyspark.ml.feature import VectorAssembler from time import sleep #Declearing consumer connection try: consumer = KafkaConsumer('stock_prices',bootstrap_servers=['localhost:9092']) excep...
StarcoderdataPython
92566
<reponame>Limmen/open_spiel<filename>open_spiel/python/games/optimal_stopping_game_approx_exp.py import math from typing import List, Tuple import gym import numpy as np import threading import time import torch from stable_baselines3 import PPO from stable_baselines3.common.monitor import Monitor from open_spiel.pytho...
StarcoderdataPython
1770777
class AnalysisType(object): """ Base class for the different analysis types """ def __init__(self, structure_model, name="DefaultAnalysisType"): self.name = name # the structure model - geometry and physics - has the Dirichlet BC # for the bottom node included self.stru...
StarcoderdataPython
3380555
<gh_stars>0 """ 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/LICENSE-2.0 Unless required by applicable law or agre...
StarcoderdataPython
3276640
from typing import Any from src.Shared.InterfaceAdapters.IFilter import IFilter class Filter(IFilter): _filters: dict def __init__(self, filter: dict): self._filters = filter defaultFilters: Any = self.getDefaultFilters() for valueKey in defaultFilters: self._filters.upd...
StarcoderdataPython
180845
<gh_stars>1-10 #!/home/adam/Documents/revkit-1.3/python #!/usr/bin/python # RevKit: A Toolkit for Reversible Circuit Design (www.revkit.org) # Copyright (C) 2009-2011 The RevKit Developers <<EMAIL>> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public...
StarcoderdataPython
3229050
import argparse import csv import functools import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from tensorflow.keras.layers import Dense, Activation from tensorflow.keras import regularizers from config import hidden_layer_size, n_params def load_dataset(file_path): print("Loading {}".fo...
StarcoderdataPython
181014
from django.contrib import admin from django.urls import reverse from django.utils.safestring import mark_safe from .models import * # Register your models here. @admin.register(Product) class ProductAdmin(admin.ModelAdmin): list_display = [field.name for field in Product._meta.fields] @admin.register(Review) cla...
StarcoderdataPython
4837224
<reponame>saavpedia/python<gh_stars>0 #!/usr/bin/env python ################################################################################ # Copyright 2018 <NAME> <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
StarcoderdataPython