id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3385620
<gh_stars>0 from yaml import load def before_all(context): context.settings = load(open('features/conf.yaml').read()) context.base_url = context.settings['base_url'] context.staging_url = context.settings['staging_base_url'] context.api_endpoints = {} context.request_headers = {} context.respo...
StarcoderdataPython
3251796
#!/usr/bin/env python """ CEP to coordinates (latitude and longitude). This script receives list of brazilian postal code and returns the latitude and longitude coordinates related to this postal code, based on information provided by Open Street Map (OSM). """ import sys # basic system library import urllib # to o...
StarcoderdataPython
71733
<gh_stars>0 """ File: pokeball Name:<NAME> ---------------------- TODO: """ from campy.graphics.gobjects import GOval, GRect, GPolygon, GArc, GRoundRect from campy.graphics.gcolor import GColor from campy.graphics.gwindow import GWindow RADIUS = 200 class Pokeball: def __init__(self, radius=RADIU...
StarcoderdataPython
1794420
<gh_stars>0 import numpy as np from scipy import ndimage from scipy import misc from PIL import Image import torch import torch.nn.functional as tf import skimage.io as io import png TAG_CHAR = np.array([202021.25], np.float32) UNKNOWN_FLOW_THRESH = 1e7 def compute_color(u, v): """ compute optical flow col...
StarcoderdataPython
55146
"""Test for hydromt.gis_utils submodule""" import pytest import numpy as np from hydromt import gis_utils as gu from hydromt.raster import full_from_transform, RasterDataArray from rasterio.transform import from_origin def test_crs(): bbox = [3, 51.5, 4, 52] # NL assert gu.utm_crs(bbox).to_epsg() == 32631 ...
StarcoderdataPython
28055
# Generated by Django 2.0.2 on 2018-03-22 21:18 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('palsbet', '0002_viptipsgames'), ] operations = [ migrations.AlterField( model_name='viptipsgames', name='cathegory',...
StarcoderdataPython
57851
""" Test integrators with simple ODE dx/dy = 3x^2y given x0 = 1, y0 = 2 ANALYTIC SOLUTION: y = e^{x^3 + c}, c = ln(2) - 1 y(1,1.1,1.2,1.3,1.4) = [2,2.78471958461639,4.141869187709196,6.6203429951303265,11.440356871885081] """ # Import package, test suite, and other packages as needed import numpy as np from pycc.rt i...
StarcoderdataPython
1764444
# -*- coding: utf-8 -*- """ Created on Thu Aug 23 22:17:05 2018 @author: yoelr """ from ._splitter import Splitter from .decorators import cost __all__ = ('MolecularSieve',) # @cost('Flow rate', 'Pressure filter drying (2)', # cost=405000, CE=521.9, S=22687, n=0.6, kW=1044) # @cost('Flow rate', 'Pressure filt...
StarcoderdataPython
1754512
#!/usr/bin/env python3.8 def getHelloWorld(): """@brief Get the message to be displayed @return Hello World""" return "Hello World"
StarcoderdataPython
81281
<filename>sekh/middleware.py """ Middleware for highlighing the keywords of an user's search in a HTML page based on http://www.djangosnippets.org/snippets/197/ """ import re try: from urllib.parse import urlsplit from urllib.parse import parse_qs except ImportError: # Python 2 from urlparse import urlspli...
StarcoderdataPython
3244719
from rest_framework import viewsets from rest_framework_extensions.mixins import DetailSerializerMixin from .models import Comment from .serializers import CommentSerializer, CommentDetailSerializer class CommentViewSet(DetailSerializerMixin, viewsets.ReadOnlyModelViewSet): serializer_class = CommentSerializer ...
StarcoderdataPython
66376
<gh_stars>0 #!/usr/bin/env python3 import csv import io import re import sys import uuid import pprint from typing import List HEADERS = ('Item', 'Category', 'Size', 'Quantity','Description', 'Staple', 'Last Modified', 'Key') # RegEx that apply to the file loaded. ALL_YOU_WERE_NOT_CHARGED = re.compile( r'\n...
StarcoderdataPython
86233
""" backend URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-base...
StarcoderdataPython
3216098
<reponame>Zepx/sequential-imagenet-dataloader # loads imagenet and writes it into one massive binary file # this file generates a lmdb with floating point values import cv2 import os import numpy as np from tensorpack.dataflow import * from tensorpack.dataflow.image import * import torch import torch.nn as nn import t...
StarcoderdataPython
107919
import pandas as pd import numpy as np import argparse from plotnine import ggplot, scale_x_continuous, theme_bw, element_rect, element_line, geom_line, scale_color_brewer, \ annotate, \ element_blank, element_text, scale_x_discrete,geom_errorbar,position_dodge, scale_y_continuous, aes, theme, facet_grid, labs,...
StarcoderdataPython
198783
<filename>{{ cookiecutter.repo_name }}/src/deform_jinja2/filters.py from jinja2 import Undefined, escape, evalcontextfilter from markupsafe import Markup @evalcontextfilter def do_htmlattr(ctx, mapping, prepend_whitespace=True): """This filter is very similar to jinja2's builtin xmlattr filter, except it remo...
StarcoderdataPython
3200861
<filename>setup.py from setuptools import find_packages, setup with open("README.md") as f: long_description = f.read() setup( name="2021-dialogue-summary-competition", version="1.1.0", description="[2021 훈민정음 한국어 음성•자연어 인공지능 경진대회] 대화요약 부문 알라꿍달라꿍 팀의 대화요약 학습 및 추론 코드를 공유하기 위한 레포입니다.", long_descripti...
StarcoderdataPython
4800605
<reponame>ifty500/asset_management<gh_stars>1-10 # coding: utf-8 from django.conf import settings from django.conf.urls.defaults import include, patterns from djcommon.helpers import construct_object class ProductListFiltersMiddleware(object): """ Middleware to set up ProductListFilters urls on incoming req...
StarcoderdataPython
3275583
def two(): pass
StarcoderdataPython
3302702
<reponame>nanhaishun/smart-chatbot # -*- coding: utf-8 -*- """ @author:XuMing(<EMAIL>),lhy<<EMAIL>> @description: """ from py2neo import Graph from config import host, kg_port, user, password, answer_num_limit class AnswerSearcher: def __init__(self): self.g = Graph( host=host, h...
StarcoderdataPython
3209880
<filename>tests/helper/fetch.py # Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) # -*- coding: utf-8 -*- """ tests.helper.fetch ~~~~~~~~~~~~~~~~~~ This file contains the set of functions that are called by the client.py in response to a query. Contributions welcome! :copyright: (c) 2021 ...
StarcoderdataPython
149384
""" The roseguarden project Copyright (C) 2018-2020 <NAME>, This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is ...
StarcoderdataPython
3269657
"""Middle English phonology tools """ from typing import List from cltk.phonology.syllabify import Syllabifier __author__ = ["<NAME> <<EMAIL>>"] class MiddleEnglishSyllabifier: """ Middle English syllabifier """ def __init__(self): self.syllabifier = Syllabifier(language="enm") def syl...
StarcoderdataPython
1778153
<gh_stars>0 # coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
StarcoderdataPython
24886
<filename>test/src/testing/universal/uart.py import gc from unittest import TestCase from testing import await_true gc.collect() class TestGPSInteractive(TestCase): def test_read_value(self): import adafruit_blinka adafruit_blinka.patch_system() # needed before adafruit_gps imports time ...
StarcoderdataPython
33162
<gh_stars>0 import numpy as np from modeler.fasttextmodel import FastTextModel from trainer.tftrainer import TFTrainer class FastTextTrainer(TFTrainer): def __init__(self): self.num_classes = 19 self.learning_rate = 0.01 self.batch_size = 8 self.decay_steps = 1000 self.dec...
StarcoderdataPython
1670996
import os from time import sleep import urllib.request from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import ElementNotInteractableException from selenium.common.exceptions import NoSuchElementException from bs4 import BeautifulSoup from openpyxl import...
StarcoderdataPython
3213567
# Copyright 2021 The Couler 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 required by applicable law or...
StarcoderdataPython
3228687
# Generated by Django 3.2.7 on 2021-09-09 16:42 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Experiment', fields=[ ('id', models.BigAuto...
StarcoderdataPython
4441
<reponame>anuragtr/fabric8-analytics-rudra import pytest from rudra.utils.mercator import SimpleMercator class TestSimpleMercator: pom_xml_content = """ <project> <dependencies> <dependency> <groupId>grp1.id</groupId> <artifactId>art1.i...
StarcoderdataPython
1781502
import harness import rates import os import bits data = None def initialize(t): global data # Very sneaky way of getting the data data = harness.load_data(os.environ["DATA"])[1] def apply_rate(t): ps = [harness.packet_stats(data[r], t, r) for r, _ in enumerate(rates.RATES)] badnesses = [bits.tx...
StarcoderdataPython
1767645
# Copyright 2020 <NAME> (@usimarit) # # 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 wr...
StarcoderdataPython
1702157
<filename>oops/#042_operator_overloading.py class A: def __init__(self, a): self.a = a # adding two objects # magic method def __add__(self, x): return self.a + x.a def __sub__(self, x): return self.a - x.a def __mul__(self, x): return self.a ...
StarcoderdataPython
87752
""" jsonable.py: Folder with helper methods that allow for seamless conversion of F prime types to JSON types. This allows us to produce data in JSON format with ease, assuming that the correct encoder is registered. Note: JSON types must use only the following data types 1. booleans 2. numbers 3. strings 4. lis...
StarcoderdataPython
38845
<filename>ensysmod/model/ts_capacity_max.py from sqlalchemy import Column, PickleType from ensysmod.database.base_class import Base from ensysmod.database.ref_base_class import RefCRBase class CapacityMax(RefCRBase, Base): max_capacities = Column(PickleType, nullable=False)
StarcoderdataPython
3288773
from git import * import os import time import main from fileio.config import parse_config from log import setup_log, log import notify.webhook import notify.server import threading import time def daemonize(squadron_dir, config_file, polltime, repo, node_name, exit_loop=threading.Event()): """ Runs squadron e...
StarcoderdataPython
61013
<filename>Solutions/Python/annee_bissextile.py #!/usr/bin/python # -*- coding: utf-8 -*- # Public Domain 2014 - Created by N07070 annee_user = input('Please enter a year in the YYYY format >> ') print 'Thanks, and your year is...' annee_user = int(annee_user) if annee_user % 4 == 0: if annee_user % 100 == 0: ...
StarcoderdataPython
179951
<gh_stars>10-100 import smart_imports smart_imports.all() class Battle1x1Result(django_models.Model): created_at = django_models.DateTimeField(auto_now_add=True, null=False) participant_1 = django_models.ForeignKey('accounts.Account', null=False, related_name='+', on_delete=django_models.CASCADE) parti...
StarcoderdataPython
3242749
import os import sys import pickle import subprocess import numpy as np import pandas as pd from Bio import SeqIO def make_fasta(seq, fname=None): if fname is None: fname = 'seq_fasta' fpath = 'tmp/seq_fasta' else: fpath = 'tmp/{}'.format(fname) f = open(fpath, 'w') f.write('>SEQ\n') f.write(seq) f.close(...
StarcoderdataPython
1705934
from process.utils import * abspath = os.path.dirname(os.path.normpath(os.path.abspath(os.path.dirname('')))) sys.path.insert(0, os.path.abspath('../src')) raw_row_holder = {} curated_row_holder = {} presentation_row_holder = {} def generate_profile(profile_path, title, key, df, filename, layer=None) -> None: ...
StarcoderdataPython
3387188
<gh_stars>1-10 from flask import Flask, Response from flask_restful import Resource, Api import time import cv2 import threading app = Flask(__name__) api = Api(app) latest_vision_result = {'state' : 'None', 'range' : 1000000, 'angle' : 900, 'time' : str(time.time())} class VisionResult(Resource): def get(self):...
StarcoderdataPython
3383220
# Generated by Django 3.2.9 on 2021-12-15 22:43 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('boards', '0001_initial'), ] operations = [ migrations.CreateModel( name='Co...
StarcoderdataPython
1649022
import requests from django.shortcuts import render from django.conf import settings from .forms import SubmitEmbed from .serializer import EmbedSerializer def save_embed(request): if request.method == 'POST': form = SubmitEmbed(request.POST) if form.is_valid(): url = form.cleaned_da...
StarcoderdataPython
1652162
from sapextractor.algo.p2p import p2p_1d_dataframe, p2p_1d_log, obj_centr_log def apply(con, ext_type, ext_arg): if ext_type == "p2p_1d_dataframe": return p2p_1d_dataframe.apply(con, **ext_arg) elif ext_type == "p2p_1d_log": return p2p_1d_log.apply(con, **ext_arg) elif ext_type == "p2p_oce...
StarcoderdataPython
4804039
<reponame>pierreablin/ksddescent<gh_stars>1-10 """ ================================ Dependence to the initialization ================================ """ # noqa # Author: <NAME> <<EMAIL>> # # License: MIT import torch from ksddescent import ksdd_lbfgs import matplotlib.pyplot as plt import numpy as np def make_mog...
StarcoderdataPython
81204
<gh_stars>1-10 # WEB_DRIVER_PATH = 'C:\chromedriver.exe' # XLSX_PATH = 'C:/dateGirls/m3/suyo_sample.xls' # START_DATE = ['20170220', '20170220', '20170220', '20170220'] # END_DATE = ['20170421', '20170421', '20170421', '20170421'] # DINING_NAME = ['나노하나', '바라티에', '서대문양꼬치', '백곰막걸리'] # BROAD_NAME = '수요미식회' # BROAD_DATE...
StarcoderdataPython
3346969
<filename>venv/lib/python3.8/site-packages/hypothesis/internal/validation.py # This file is part of Hypothesis, which may be found at # https://github.com/HypothesisWorks/hypothesis/ # # Most of this work is copyright (C) 2013-2020 <NAME> # (<EMAIL>), but it contains contributions by others. See # CONTRIBUTING.rst for ...
StarcoderdataPython
16131
<reponame>tsmonteiro/fmri_proc<gh_stars>1-10 import keras.backend as K from keras.engine import Layer, InputSpec from keras.layers import Concatenate from keras import initializers import numpy as np import tensorflow as tf import tensorflow_probability as tfp class MixtureDensityLayer(Layer): """ Layer for...
StarcoderdataPython
3330028
from c0.greet import * import Pyro4 def start_without_ns(): daemon = Pyro4.Daemon() x_GreetServer = Pyro4.expose(GreetServer) uri = daemon.register(x_GreetServer) print("my URI : ", uri) daemon.requestLoop() def start_with_ns(): #name server harus di start dulu dengan pyro4-ns -n localhost...
StarcoderdataPython
3252652
# -*- coding: utf-8 -*- import pytest from virtual_finance_api.generic import isin def test__isin(): """ISINCode.""" ic = isin.ISINCode("BE0003788057") assert ( ic.country == "BE" and ic.NSIN == "000378805" and ic.code == "BE0003788057" and ic.passed is True and st...
StarcoderdataPython
4828902
<filename>pyopenapi/migration/versions/v2_0/scanner/norm_ref.py<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import absolute_import from .....utils import normalize_jr from ....scan import Dispatcher from ..objects import ( Schema, PathItem, Reference, ) from ..attrs import ( SchemaAttributeGr...
StarcoderdataPython
80002
<filename>tests/test_base_client.py import unittest from mock import MagicMock, ANY, patch from uuid import uuid4 from formencode import Schema, Invalid import six from launchkey.clients.base import api_call, ERROR_CODE_MAP, STATUS_CODE_MAP, \ BaseClient from launchkey.exceptions import LaunchKeyAPIException, Inva...
StarcoderdataPython
1655684
<reponame>UniStuttgart-VISUS/damast #!/usr/bin/env python3 import yaml import sys with open(sys.argv[1]) as f: users = yaml.safe_load(f) uid = 1 for user, props in users.items(): if 'user' in props['roles']: print(F"INSERT INTO users (id, name, comment) VALUES ({uid}, '{user}', 'pyte...
StarcoderdataPython
1622959
<filename>Week2/Assignment2/space_kd_trees.py import numpy as np from astropy.coordinates import SkyCoord from astropy import units as u import time def crossmatch(cat1, cat2, max_dist): matches = [] no_matches = [] start = time.perf_counter() skycat1 = SkyCoord(cat1*u.degree, frame='icrs') skycat2 = Sky...
StarcoderdataPython
1669278
# !/usr/bin/env python # -*- coding: utf-8 -*- # author: chinshin # datetime: 2020/4/20 15:49 import os from torch.utils.data import DataLoader from argparse import ArgumentParser, Namespace from bert.utils.logger_utils import create_logger from bert.utils.data_utils import get_pubchem_zinc_path, get_availabl...
StarcoderdataPython
104895
<reponame>jerrykuo7727/QA-FGC-joint-sep import re import sys import json from os.path import join, exists from transformers import BertTokenizer def tokenize_no_unk(tokenizer, text): split_tokens = [] for token in tokenizer.basic_tokenizer.tokenize(text, never_split=tokenizer.all_special_tokens): wp_to...
StarcoderdataPython
105440
""" Gradcam visualization ref modified from implementation by fchollet (https://keras.io/examples/vision/grad_cam) """ import cv2 import numpy as np import os import sys import argparse import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers # Displa...
StarcoderdataPython
85672
# -*- coding: utf-8 -*- ''' @author: kebo @contact: <EMAIL> @version: 1.0 @file: tensorboard.py @time: 2021/05/12 01:18:35 这一行开始写关于本文件的说明与解释 ''' import tensorflow as tf import datetime from cybo.training.utils import Mode class TensorBoard: def __init__(self, logs_dir: str = 'logs/') -> None: current...
StarcoderdataPython
1702020
<gh_stars>1-10 # Simple CNN for the MNIST Dataset from tensorflow.keras.datasets import mnist from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from tensorflow.keras.layers import Dropout from tensorflow.keras.layers import Flatten from tensorflow.keras.layers.convolutional import...
StarcoderdataPython
1797825
from django.contrib.auth.models import Group from django.contrib.auth.admin import UserAdmin from django.contrib.auth.forms import ReadOnlyPasswordHashField from django.contrib import admin from .models import BusinessProfile, ParticipantProfile, EventProfile, AdminProfile, User class UserAdmin(UserAdmin): li...
StarcoderdataPython
5233
<reponame>dongboyan77/quay import pytest from mock import patch from data.cache import InMemoryDataModelCache, NoopDataModelCache, MemcachedModelCache from data.cache.cache_key import CacheKey class MockClient(object): def __init__(self, server, **kwargs): self.data = {} def get(self, key, default=...
StarcoderdataPython
177575
<filename>2020/day08.py class solve_day(object): with open('inputs/day08.txt', 'r') as f: data = f.readlines() data = [d.strip() for d in data] def part1(self): accumulator = 0 i = 0 index_tracker = [] index_visited = set() index_tracker.append(i) ...
StarcoderdataPython
106946
# Generated by Django 3.0.5 on 2020-04-27 14:35 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('socialaccount', '0003_extra_data_default_dict'), ('workspaces', '0006_workspaceuserconnect'), ] operations ...
StarcoderdataPython
3372828
"""Test definition of electrophysiological datasets.""" import numpy as np from frites.dataset import DatasetEphy from frites.simulations import sim_multi_suj_ephy, sim_mi_cc from frites.io import set_log_level set_log_level(False) class TestDatasetEphy(object): # noqa @staticmethod def _get_data(n_subje...
StarcoderdataPython
127461
from torch_sparse import coalesce def dense_to_sparse(tensor): index = tensor.nonzero() value = tensor[index] index = index.t().contiguous() index, value = coalesce(index, value, tensor.size(0), tensor.size(1)) return index, value
StarcoderdataPython
1659779
# Generated by Django 3.0.4 on 2020-05-18 10:15 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('title', '0001_initial'), ] operations = [ migrations.DeleteModel( name='Title', ), ]
StarcoderdataPython
4824822
# -*- coding: utf-8 -*- """ step8.services.BeaconsHttpServiceV1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BeaconsHttpServiceV1 class :copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ from pip_services3_commons.refer i...
StarcoderdataPython
95672
<reponame>XinzheL/allennlp<filename>tests/data/token_indexers/pretrained_transformer_indexer_test.py import pytest from allennlp.common import cached_transformers from allennlp.common.testing import AllenNlpTestCase from allennlp.data import Vocabulary from allennlp.data.token_indexers import PretrainedTransformerInde...
StarcoderdataPython
195680
<filename>tests/test_baseline.py<gh_stars>10-100 def test_baselineEnv(): try: import gym from stable_baselines.common.vec_env import DummyVecEnv from stable_baselines.deepq.policies import MlpPolicy from stable_baselines import DQN env = gym.make('CartPole-v1') mode...
StarcoderdataPython
1709596
<filename>1_Datentypen/03_tuples/_04_i_m_not_a_number_i_have_a_name.py ############ Tricky => not so optimal ################# # for d in get_data_tricky(): ########### Better solution ########################
StarcoderdataPython
32172
import os from configurations.importer import install from mypy.version import __version__ # noqa: F401 from mypy_django_plugin import main def plugin(version): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') os.environ.setdefault('DJANGO_CONFIGURATION', 'Development') install() ret...
StarcoderdataPython
3260093
# app.py import copy import time from sudoku.rule import Rule from utils.load_data import load_sudokus from utils.status import Status if __name__ == '__main__': file_name = "data/sudoku-problem.txt" puzzles = load_sudokus(file_name) solved = 0 total_time = 0 for puzzle in copy.deepcopy(puzzles):...
StarcoderdataPython
182431
counter = 0 while counter <= 5: print("counter", counter) counter = counter + 1 else: print("counter has become false ")
StarcoderdataPython
124771
<reponame>mt3443/typosquatting # Gets transitive dependency statistics for PyPI from statistics import mean, median, mode import pickle dls = pickle.load(open('../pickle/pypi_dl_count_dict.p', 'rb')) packages = open('../data/pypi_dependencies').read().splitlines() depednency_tree_sizes = [] for p in pac...
StarcoderdataPython
133642
from database import metadata import logging logger = logging.getLogger(__name__) def database_check_init(): if 'tournament' in metadata.tables and 'rule_set' in metadata.tables and \ 'match' in metadata.tables and 'team' in metadata.tables: logger.info("Database exists, and is proper") e...
StarcoderdataPython
121420
from rest_framework import serializers from .models import Organization class OrganizationSerializer(serializers.ModelSerializer): class Meta: model = Organization fields = ['org_id', 'org_name', 'address', 'status', 'inventory_items_refresh_job', 'calendar_date', 'file', 'ftp_lo...
StarcoderdataPython
3282687
<filename>tests/tests_ecg.py import numpy as np import pandas as pd import neurokit2 as nk # ============================================================================= # ECG # ============================================================================= def test_ecg_simulate(): ecg1 = nk.ecg_simulate(duratio...
StarcoderdataPython
25277
<filename>packages/robot/odahuflow/robot/libraries/sdk_wrapper.py # for class Model import json from odahuflow.sdk import config from odahuflow.sdk.clients.api_aggregated import parse_resources_file_with_one_item from odahuflow.sdk.clients.configuration import ConfigurationClient from odahuflow.sdk.clients.connection ...
StarcoderdataPython
180862
<filename>util/__init__.py def full_path(p=""): return os.path.join(os.path.dirname(__file__), p)
StarcoderdataPython
3357231
import numpy as np import tensorflow as tf import matplotlib.image as mpimg import sys, os import cv2 import skimage.io sys.path.insert(0,"scd") import scd def main(): filepath="/workspace2/kitti/testing/image_2/007481.png" filepath="test/test0_2.jpg" filepath="test/test1_2.jpg" filepath="test/noise3.j...
StarcoderdataPython
1768010
# Time: O(min(n, h)), per operation # Space: O(min(n, h)) # 211 # Ming: Time Complexity: addWord - O(L) , search - O(26L), Space Complexity - O(26L) 这里 L是单词的平均长度。 # http://www.cnblogs.com/yrbbest/p/4979621.html # More follow up: http://www.cnblogs.com/EdwardLiu/p/5052887.html # # Design a data structure that su...
StarcoderdataPython
3255061
<gh_stars>10-100 #=========================================================================== # # Copyright (c) 2014, California Institute of Technology. # U.S. Government Sponsorship under NASA Contract NAS7-03001 is # acknowledged. All rights reserved. # # Redistribution and use in source and binary forms, with or ...
StarcoderdataPython
3208765
#!/usr/bin/env python3 import logging import os import re from typing import List, Dict from Crypto.Cipher import AES from Crypto.Util.Padding import pad from obfuscapk import obfuscator_category from obfuscapk import util from obfuscapk.obfuscation import Obfuscation class LibEncryption(obfuscator_category.IEncry...
StarcoderdataPython
1646368
import faker.config from django.conf import settings from elasticsearch.helpers.test import get_test_client from elasticsearch_dsl.connections import add_connection from pytest import fixture from rest_framework.test import APIClient from apartment.tests.factories import ApartmentDocumentFactory faker.config.DEFAULT_...
StarcoderdataPython
3203007
import torch.nn as nn import torch.nn.functional as F import math import torch from torch.nn import Parameter import math def uniform(size, tensor): stdv = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-stdv, stdv) def glorot(tensor): stdv = math.sqrt(6.0 / (tensor.size(-2) + ...
StarcoderdataPython
3301510
<reponame>ValRCS/Python_TietoEvry_Sep2021<filename>Day_3_Boolean_Logic_Conditionals/day3_uzd3.py # a = float(input("Enter number: ")) while True: first_number = input(f"Please enter first number: ") try: a = float(first_number) # will throw exception if not a number except ValueError: print...
StarcoderdataPython
3268793
<gh_stars>0 from django.apps import AppConfig class ClientTicketConfig(AppConfig): name = 'client_ticket'
StarcoderdataPython
81608
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # __init__.py # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # Copyright (C) 2021 ETH Zurich # # 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
1714829
<gh_stars>1-10 """Contains classes that pertain to anything light related.""" from rpi_ws281x import Color, ws, PixelStrip import os import time class BACKLIGHT(): def __init__(self, count=7, pin=10): """ At instantiation, define the following defaults. Parameters ---------- ...
StarcoderdataPython
57127
<gh_stars>1-10 from .argantic import Argantic __all__ = [Argantic]
StarcoderdataPython
3234922
<filename>compiler/back_end/cpp/build_defs.bzl<gh_stars>0 # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # U...
StarcoderdataPython
3384027
from xoa_driver import modules # region Vlkyrie Modules valkyrie_modules = { # family_d "Odin-1G-3S-6P-E": modules.MOdin1G3S6PE, "Odin-1G-3S-6P": modules.MOdin1G3S6P, "Odin-1G-3S-6P[b]": modules.MOdin1G3S6P_b, "Odin-1G-3S-2P-T": modules.MOdin1G3S2PT, # family_e "Odin-5G-4S-6P-CU": mod...
StarcoderdataPython
66510
import sys from io import StringIO from PySide6.QtCore import * from PySide6.QtGui import * from PySide6.QtWidgets import * from modules.settings.settings import SettingsManager from modules.pseudo_id.pseudo_id import PseudoIDManager from gms_uploader.modules.models.pandasmodel import PandasModel from gms_uploader.mo...
StarcoderdataPython
3305812
import numpy as np import cv2 import random face_cascade = cv2.CascadeClassifier('D:\python36\Lib\site-packages\cv2\data\haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('D:\python36\Lib\site-packages\cv2\data\haarcascade_eye.xml') #先检测人脸,存到face.jpg中 cap=cv2.VideoCapture(0) while(T...
StarcoderdataPython
70346
import os import fnmatch import re import glob __author__ = "<NAME>" __license__ = "MIT" __email__ = "<EMAIL>" class Project: """ This classes is used to mine a cloned repository and extract matches between tests and classes under test """ def __init__(self, project, include_pattern, exclude_pa...
StarcoderdataPython
3247521
import numpy as np import tensorflow as tf import Nn from Algorithms.tf2algos.base.policy import Policy class MADDPG(Policy): def __init__(self, s_dim, a_dim_or_list, is_continuous, ployak=0.995, actor_lr=5.0e-4, ...
StarcoderdataPython
124276
<reponame>Simek13/Retinal-fluid-segmentation from PIL import Image import os import numpy as np def create_dirs(directory): if not os.path.exists(directory): os.makedirs(directory) def create_images(image_folder, output_folder, files_extension): files_name = os.listdir(image_folder) for file in ...
StarcoderdataPython
1771608
from typing import Optional, Iterable import faker from pkg_resources import DistInfoDistribution, Requirement fake = faker.Faker() faker.Faker.seed(0) def package_factory( project_name: Optional[str] = None, version: Optional[str] = None, requirements: Optional[Iterable[Requirement]] = None, ) -> DistI...
StarcoderdataPython
147353
<filename>wiser_care_theme/www/products_search.py # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe.utils import cstr, nowdate, cint from erpnext.setup.doctype.item_group.item_...
StarcoderdataPython
1742078
""" parser.py Parse the input code from execution program. """ import argparse import sys # Get the version # AG - python 3 decided it doesn't like scripts inside modules. # I have read some posts about it and no one has a real solution. # http://stackoverflow.com/questions/16981921/relative-imports-in-python-3 try:...
StarcoderdataPython