id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3254943
<filename>logalpha/color.py # This program is free software: you can redistribute it and/or modify it under the # terms of the Apache License (v2.0) as published by the Apache Software Foundation. # # This program is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied wa...
StarcoderdataPython
86913
"""Algo class definition.""" import os import sys import logging import argparse import pandas as pd from datetime import datetime from aqtlib import utils, Broker, Porter from aqtlib.objects import DataStore from abc import abstractmethod from .instrument import Instrument __all__ = ['Algo'] class Algo(Broker): ...
StarcoderdataPython
1622256
story = "once upon a time there was a githubber named Sparsh who uploaded project files" # String functions # print(len(story)) # print(story.endswith("files")) # print(story.count("a")) # print(story.capitalize()) # capitalized first letter only # print(story.find("upon")) print(story.replace("Sparsh", "Anurag "))
StarcoderdataPython
3275270
<gh_stars>1-10 # http://www.prologin.org/training/challenge/demi2014/correction from sys import stdin, exit from itertools import combinations nbRegions = int(stdin.readline()) nbSheets = [int(x) for x in stdin.readline().split()] # Quick check to save us some time if sum(nbSheets) % 2 == 1: print 0 exit() target =...
StarcoderdataPython
13126
<filename>pcdet/models/backbones_3d/vfe/pillar_vfe.py import torch from torch_geometric.nn import FeaStConv from knn_cuda import KNN from torch_cluster import fps #from ....ops.roiaware_pool3d import roiaware_pool3d_utils import torch.nn as nn import torch.nn.functional as F from .vfe_template import VFETemplate impo...
StarcoderdataPython
3206219
<filename>src/hammer-vlsi/hammer_vlsi/cli_driver.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # cli_driver.py # CLI driver class for the Hammer VLSI abstraction. # # See LICENSE for licence details. import argparse import json import os import subprocess import sys from .hammer_vlsi_impl import HammerTool, ...
StarcoderdataPython
3210132
#!/usr/bin/env python # coding:utf-8 import random import inspect import urlparse import traceback from collections import Iterable from pkgutil import iter_modules import gevent from gevent import Greenlet from crawler.http import Request, Response from crawler.queue import Empty class Spider(Greenlet): name =...
StarcoderdataPython
1724707
<reponame>Farhan-Malik/advance-hand-gesture<filename>main.py import sys from PyQt5.QtWidgets import QApplication, QMainWindow from PyQt5 import uic, QtCore from screen import Screen counter = 0 class Main(QMainWindow): def __init__(self): super().__init__() uic.loadUi("splash_screen.ui", self) ...
StarcoderdataPython
117341
<reponame>hpusset/marshmallow-jsonschema from pkg_resources import get_distribution __version__ = get_distribution('marshmallow-jsonschema').version __license__ = 'MIT' from .base import dump_schema __all__ = ( 'dump_schema' )
StarcoderdataPython
1703842
<filename>tml/source.py from .dictionary.source import SourceDictionary class SourceTranslations(object): """Locale => Translation dictionary per single source.""" def __init__(self, source, application): self.source = source self.application = application self.cache = {} self....
StarcoderdataPython
1768659
import numpy as np import matplotlib.pyplot as plt from matplotlib import pyplot from matplotlib.figure import figaspect import time import os import random import threading plt.rcdefaults() pyplot.locator_params(nbins=5) class PlotGenerator: lock = threading.Lock() def __init__(self): self.fig_n = ...
StarcoderdataPython
3335932
from .parameters import Parameters class ParametersDomainAncillaries(Parameters): """Mixin to collect named parameters and domain ancillaries. .. versionadded:: (cfdm) 1.7.0 """ def __init__( self, parameters=None, domain_ancillaries=None, source=None, copy=True ): """**Initiali...
StarcoderdataPython
1689963
from torch import nn import numpy as np class Flatten(nn.Module): def forward(self, input): return input.view(input.size(0), -1) def gen_fc_dim(cnn_config, feathers): for idd, filter_size in enumerate(cnn_config[0]): feathers = (feathers - int(filter_size) + 1 - int(cnn_config[2...
StarcoderdataPython
3248470
from ..core.testcase import TestCase from ..core.decorators import testmethod class ExampleTests(TestCase): def __init__(self): pass @testmethod def testTrue(self): self.assertTrue(True) @testmethod def testFails(self): self.assertTrue(False) class OtherTests(TestCase): ...
StarcoderdataPython
172712
from django.contrib.auth import get_user_model from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase REGISTER_USER = reverse('rest_register') PROFILES = reverse('profile-list') FRIENDS = reverse('profile-my-friends') def detail_url(profile_id): """Return pr...
StarcoderdataPython
13388
import requests import os import subprocess import gidgethub from gidgethub import sansio AUTOMERGE_LABEL = ":robot: automerge" def comment_on_pr(issue_number, message): """ Leave a comment on a PR/Issue """ request_headers = sansio.create_headers( "miss-islington", oauth_token=os.getenv("...
StarcoderdataPython
4831990
from pydispatch import dispatcher from twisted.internet import utils from phxd.constants import * from phxd.permissions import * from phxd.server.config import conf from phxd.server.decorators import * from phxd.server.signals import * from phxd.types import HLException, HLFile, HLResumeData from phxd.utils import HLE...
StarcoderdataPython
187787
<gh_stars>0 from django import forms from django.forms import ModelForm from .models import * class TareaForm(forms.ModelForm): class Meta: model = Tarea fields = '__all__'
StarcoderdataPython
3390787
#!/usr/bin/python3 import fileinput groups = [[]] for l in fileinput.input(): line = l.strip() if 'ticket' in line: continue if line == "": groups.append([]) else: groups[-1].append(line) fields, your, other = groups def valset(f): parts = f.split(': ') k = parts[0] parts...
StarcoderdataPython
199883
<filename>schema_enforcer/ansible_inventory.py """Ansible Inventory class to generate final hostvars based on group_vars and host_vars.""" from ansible.inventory.manager import InventoryManager from ansible.parsing.dataloader import DataLoader from ansible.vars.manager import VariableManager from ansible.template impor...
StarcoderdataPython
1709347
# Copyright (C) 2014 - <NAME> <<EMAIL>> # This program is Free Software see LICENSE file for details from ..meta_handler import AnacondaHandlerMeta class AnacondaHandlerProvider: """Just a convenience wrapper """ __metaclass__ = AnacondaHandlerMeta
StarcoderdataPython
1632240
<filename>jira/table.py import inject from prettytable import PrettyTable BOLD = 1 FROM_PALETTE = 5 UNDERSCORE = 4 BG_COLOR = 48 def make_format(*values): def render(*args): return coloring.format(*args) coloring = '\x1b[' + ';'.join(map(str, values)) + 'm{}\x1b[m' return render DEFAULT_FORMAT = ...
StarcoderdataPython
3299095
<filename>ROS_ws/src/driver/traj_tracking_ros/src/Tracking_Stanley/tracking_visualizer.py #!/usr/bin/env python import rospy from nav_msgs.msg import Odometry from traj_msgs.msg import TrajMsg from std_msgs.msg import Bool from IPython import display from threading import Lock import matplotlib.pyplot as plt from Trac...
StarcoderdataPython
1760870
#!/usr/bin/env python """Test all EPub methods against a random book from Project Gutenberg.""" import os, unittest, random from pathlib import Path import xml.etree.ElementTree as ET import epubmangler # Select a book from local selection of epubs DIR = '/home/david/Projects/epubmangler/books/gutenberg' # DIR = '...
StarcoderdataPython
144558
from flask import json, Response, current_app, request from flask_restx import Resource, Namespace from application.utils.utils import get_sentiment from application.utils.data_transfer_objects import DataTransferObjects api = Namespace("sentiment", description="Sentiment Analysis") dtos = DataTransferObjects(api) @...
StarcoderdataPython
143255
<reponame>ArmstrongYang/StudyShare ''' Data Types - RDD-based API http://spark.apache.org/docs/latest/mllib-data-types.html ''' import numpy as np import scipy.sparse as sps from pyspark.mllib.linalg import Vectors # Use a NumPy array as a dense vector. dv1 = np.array([1.0, 0.0, 3.0]) # Use a Python list as a dense v...
StarcoderdataPython
1606239
<reponame>LBaeriswyl/CO600-Musical-Analysis """ COORDINATOR MODULE - This module contains our inbuilt Coordinators and the base Coordinator. All Coordinators inherit the Coordinator base class. Users wanting to create their own custom coordinator, should inherit from Coordinator. For detailed inform...
StarcoderdataPython
137536
import operator import random import time from inspect import signature from itertools import chain, count, islice, repeat from types import SimpleNamespace from about_time import about_time from .utils import fix_signature from ..utils.cells import fix_cells, is_wide, join_cells, strip_marks, to_cells from ..utils.c...
StarcoderdataPython
3315946
<reponame>beneboy/catdb from django.shortcuts import render, redirect from cats.forms import CatForm, BreedForm from cats.models import Cat, Breed def index(request): return render(request, 'index.html') def cats(request): return render(request, 'object_list.html', {'single_view_name': 'single_cat', 'objec...
StarcoderdataPython
1760358
<filename>src/imageboard/migrations/0001_initial.py # Generated by Django 2.1 on 2018-08-04 14:13 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_de...
StarcoderdataPython
1729098
<reponame>basileMarchand/smil from smilPython import * from math import * # Load an image imIn = Image("https://smil.cmm.minesparis.psl.eu/images/tools.png") imIn.show() imThr = Image(imIn) topHat(imIn, imThr, hSE(20)) threshold(imThr, imThr) imLbl = Image(imIn, "UINT16") label(imThr, imLbl) imLbl.showLabel() def f...
StarcoderdataPython
140221
import numpy as np try: import cupy as cp except: cp = np #CupyScalars = NumpyScalars import pytissueoptics.vectors as vc class NativeScalars: """ An array of scalars that is compatible with operations on Vectors There is a reason for not using numpy.array directly: we want to add new functi...
StarcoderdataPython
26790
<filename>pytorch_toolkit/instance_segmentation/segmentoly/rcnn/openvino_net.py """ Copyright (c) 2019 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....
StarcoderdataPython
134622
<gh_stars>0 #!/usr/bin/env python3 # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
StarcoderdataPython
3225636
from RLTest import Env import random def aofTestCommon(env, reloadfn): # TODO: Change this attribute in rmtest env.cmd('ft.create', 'idx', 'schema', 'field1', 'text', 'field2', 'numeric') reloadfn() for x in range(1, 10): env.assertCmdOk('ft.add', 'idx', 'd...
StarcoderdataPython
1674125
<filename>solutions/python3/1125.py class Solution: def smallestSufficientTeam(self, req_skills: List[str], people: List[List[str]]) -> List[int]: n, m = len(req_skills), len(people) key = {v: i for i, v in enumerate(req_skills)} dp = {0: []} for i, p in enumerate(people): ...
StarcoderdataPython
3287298
<filename>second_experiment/create_paste_labels_dataset_2.py """ Create a paste labels dataset. """ import csv dirs_1 = ['train', 'validation', 'test'] dirs_2 = [] density = 200 while density <= 780: dirs_2.append(str(density)) if density == 780: break if density < 600: density += 50 el...
StarcoderdataPython
3279479
<reponame>mugwaneza/caets<gh_stars>0 # Generated by Django 3.2.7 on 2021-12-22 20:06 import datetime from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( ...
StarcoderdataPython
1737982
# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-03-22 14:03 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('users', '0010_populate_usersinvitation'), ] operations = [ # This migration origin...
StarcoderdataPython
1751514
<filename>pyawx/models/_mixins.py from copy import deepcopy class DataModelMixin: """ Base data model structure """ __deleted__ = False def __init__(self, **kwargs): self._data = deepcopy(kwargs) self._changes = dict() self._cache = dict() def __repr__(self): ...
StarcoderdataPython
118001
# -*- coding: utf-8 -*- import unittest import mock from openregistry.concierge.mapping_types import ( LazyDBMapping, RedisMapping, VoidMapping, MappingConfigurationException ) class TestRedisDB(unittest.TestCase): def setUp(self): self.patch_strict_redis = mock.patch('openregistry.conci...
StarcoderdataPython
3340220
## @package pypowerextender # @file PowerExtender.py # @author <NAME> # @brief Defines function to interface the power-extender board # @version 0.0.1 # @date 2021-07-20 from enum import IntEnum import smbus import time from . import ADS1115_Registers from . import PCA9557_Registers PERIPHERAL_GPIO_ADDRESS = 0x18 #...
StarcoderdataPython
3246602
<filename>models/voc/mobilenetv2.py """ Creates a MobileNetV2 Model as defined in: <NAME>, <NAME>, <NAME>, <NAME>, <NAME>. (2018). MobileNetV2: Inverted Residuals and Linear Bottlenecks arXiv preprint arXiv:1801.04381. import from https://github.com/tonylins/pytorch-mobilenet-v2 """ import torch.nn as nn import math ...
StarcoderdataPython
1763157
''' Searches for reaction pathways within an overarching formose reaction network based on the transfer of modulated input concentrations to reaction products. ''' import sys import numpy as np import pandas as pd import networkx as nx from rdkit import Chem from pathlib import Path # add the SCRIPTS directory to the ...
StarcoderdataPython
3361969
<reponame>tukss/yt import argparse import configparser import os import shutil import sys from yt.config import _OLD_CONFIG_FILE, CURRENT_CONFIG_FILE, YTConfigParser CONFIG = YTConfigParser() CONFIG.read([CURRENT_CONFIG_FILE]) def get_config(section, option): return CONFIG.get(section, option) def set_config(...
StarcoderdataPython
3313959
""" .. module:: VisMPL :platform: Unix, Windows :synopsis: Matplotlib visualization component for NURBS-Python (experimental) .. moduleauthor:: <NAME> <<EMAIL>> """ from . import Abstract from . import utilities from . import numpy as np import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D impor...
StarcoderdataPython
3275206
# Generated by Django 3.2.4 on 2021-07-14 20:23 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('products', '0001_initial'), ] operations = [ migrations.CreateModel( name='Comments', ...
StarcoderdataPython
3323295
<gh_stars>1-10 import pytz from django.db import models from django.utils import timezone class Reminder(models.Model): """The reminder objects used to retain reminder informations, dates etc""" name = models.CharField(max_length=150, default="none", unique=True) start_time = models.DateTimeField(null=T...
StarcoderdataPython
3351648
from Phase0 import phase0 #from Phase0_1 import phase0_1 from Phase1 import phase1 from Phase3 import phase3 #-------------------- Callsign = "" Contest_name = "" #FD_coe = 1 okng = True Ph0_data = [] #---------------------------------------------------------------------------------- print("+----------------------...
StarcoderdataPython
1687832
<reponame>pedrodiamel/colorchecker-detection import numpy as np from skimage import color from . import utils as utl class ColorChecker(object): """ColorChecker Classic model""" stype = ''; chartcolor = [[0,0,0,0,0,0]]; dim = [1,1]; sRgb = [1, 2, 3]; cieLab = [4, 5, 6]; boxsize = [1,1];...
StarcoderdataPython
1651716
import tensorflow as tf import subprocess def build_cluster(cfg): # Cluster configuration workers = list() if cfg.remote is None: # Build a cluster in local machine for i in range(cfg.num_workers): ipport = cfg.local_ip + ":" + str(cfg.worker_port + i) workers.append...
StarcoderdataPython
184323
# Generated by Django 3.1.7 on 2021-07-23 18:49 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('accounts', '0001_initial'), ('products', '0001_initial'), ] operations =...
StarcoderdataPython
3387588
<gh_stars>1-10 import unittest import json from datetime import datetime from localstack.utils.aws import aws_stack TEST_SECRET_NAME_1 = 'test_secret_put' TEST_SECRET_NAME_2 = 'test_secret_2nd' TEST_SECRET_NAME_3 = 'test_secret_3rd' RESOURCE_POLICY = { 'Version': '2012-10-17', 'Statement': [{ 'Effect'...
StarcoderdataPython
3690
# # Modified by <NAME> # Contact: <EMAIL> # # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ OneNet Transformer class. Copy-paste from torch.nn.Transformer with modifications: * positional encodings are passed in MHattention * extra LN at the end of encoder is removed * decoder re...
StarcoderdataPython
1691839
<reponame>simodalla/pympa-utils # -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils.timezone import now from .managers import PublishedManager class Published(models.Model): published_from = models.DateTimeField(_('published from'), defa...
StarcoderdataPython
62647
from .deepl import DeeplTranslateProvider from .google import GoogleTranslateProvider
StarcoderdataPython
4822130
from setuptools import setup, find_packages requirements = [] with open('requirements.txt') as file: for line in file: if line: requirements.append(line) setup( name='python_heroku_twitter_random_sentence_generator', packages=find_packages(), version='0.2', description='A Pyth...
StarcoderdataPython
1761446
from django.db import models from core.models.base import BaseModel from core.models.taxonomic_species import TaxonomicSpecies class TaxonomicSubspecies(BaseModel): class Meta: app_label = 'core' default_permissions = () db_table = 'taxonomic_subspecies' unique_together = ("taxono...
StarcoderdataPython
27993
<filename>splitgraph/commandline/image_creation.py<gh_stars>1-10 """ sgr commands related to creating and checking out images """ import sys from collections import defaultdict import click from splitgraph.commandline.common import ImageType, RepositoryType, JsonType, remote_switch_option from splitgraph.config impor...
StarcoderdataPython
1652303
<gh_stars>1-10 from rest_framework import generics from rest_framework import permissions from rest_framework.response import Response from rest_framework.views import status from django.http import JsonResponse from .models import Student, STAGES from .serializers import StudentSerializer from .decorators import vali...
StarcoderdataPython
3227644
from urllib.parse import urlparse from google.cloud import storage import numpy as np import resampy import tensorflow as tf import urllib.request import itertools import io import jsonlines from pydub import AudioSegment import yamnet.params as yamnet_params import yamnet.yamnet as yamnet_model import os from ar...
StarcoderdataPython
3277397
name = "" age = "" health = 0 money = 0 power = 0 speed = 0 defense_power = 0 def attack(power_of_enemy, speed_of_enemy, health_of_enemy): pass def get_attacked(power_of_enemy, speed_of_enemy, health_of_enemy): pass def block(power_of_enemy, speed_of_enemy): if power_of_enemy > defense_power: get...
StarcoderdataPython
198656
#!/usr/bin/python import sys, os import numpy as np currentpath = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..')) sys.path.append(currentpath) from TBotTools import pid, geometry, pgt from time import time import pygame import pygame.gfxdraw import pygame.locals as pgl from collections import deque fro...
StarcoderdataPython
3332864
from flask import render_template, flash, request, current_app from flask_mail import Message from app.contact import contact_bp, mail from app.forms import ContactForm @contact_bp.route("/contact", methods=["GET", "POST"]) def contact(): form = ContactForm(request.form) if request.method == "POST": ...
StarcoderdataPython
3292048
from bricks_modeling.file_IO.model_reader import read_bricks_from_file from bricks_modeling.file_IO.model_writer import write_bricks_to_file from util.debugger import MyDebugger from bricks_modeling.bricks.brick_factory import get_all_brick_templates from bricks_modeling.bricks.brickinstance import BrickInstance import...
StarcoderdataPython
1766847
""" Utility methods for PyUpdaterWxDemo. """ import socket def GetEphemeralPort(): """ Return an unused ephemeral port. """ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(("", 0)) port = sock.getsockname()[1] sock.close() return port
StarcoderdataPython
3242256
from django_filters.rest_framework import DjangoFilterBackend from rest_framework.decorators import action from rest_framework.response import Response from rest_framework.viewsets import ModelViewSet from rdmo.core.exports import XMLResponse from rdmo.core.permissions import HasModelPermission from rdmo.core.viewsets...
StarcoderdataPython
81457
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket 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 applicab...
StarcoderdataPython
4806674
<reponame>lyoniionly/django-cobra<gh_stars>1-10 from __future__ import absolute_import, print_function from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils import timezone from cobra.core.compat import AUTH_USER_MODEL from cobra.core.constants import MEMBER_TYPE...
StarcoderdataPython
6848
<filename>dags/mailsdag.py # -*- coding: utf-8 -*- # # 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 ...
StarcoderdataPython
1785019
import numpy as np from qtrader.agents.base import Agent class UniformAgent(Agent): """Uniform agent.""" _id = 'uniform' def __init__(self, action_space): self.N = action_space.shape[0] def act(self, observation): return np.ones(self.N) / self.N
StarcoderdataPython
70626
#! /usr/bin/env python3 """ ONTAP REST API Python Sample Scripts This script was developed by NetApp to help demonstrate NetApp technologies. This script is not officially supported as a standard NetApp product. Purpose: THE FOLLOWING SCRIPT SHOWS WORKFLOW OF QTREE, QUOTA CREATION, Show METRICS of QTREE u...
StarcoderdataPython
1723224
from hera import InputParameter, OutputPathParameter, Task, Workflow, WorkflowService def produce(): with open('/test.txt', 'w') as f: f.write('Hello, world!') def consume(msg: str): print(f'Message was: {msg}') p = Task('p', produce, outputs=[OutputPathParameter('msg', '/test.txt')]) c = Task('c'...
StarcoderdataPython
116978
<filename>dist_zero/cgen/common.py import json def escape_c_string(s): return json.dumps(s) global_i = [0] def inc_i(): global_i[0] += 1 return global_i[0] INDENT = ' ' INDENT_TWO = INDENT + INDENT INDENT_THREE = INDENT + INDENT + INDENT
StarcoderdataPython
1774183
<filename>tests/test_shapes.py import pytest import os from copy import deepcopy import numpy as np from wsireg.reg_shapes import RegShapes HERE = os.path.dirname(__file__) GEOJSON_FP = os.path.join(HERE, "fixtures/polygons.geojson") @pytest.mark.usefixtures("complex_transform") def test_RegShapes_transform(complex_...
StarcoderdataPython
4429
<filename>test/test_add_group.py<gh_stars>0 # -*- coding: utf-8 -*- from model.group import Group import pytest import allure_pytest def test_add_group(app, db, check_ui, json_groups): group0 = json_groups #with pytest.allure.step("Given a group list"): old_groups = db.get_group_list() #with pytest.all...
StarcoderdataPython
26920
<filename>clairvoyance/preprocessing/__init__.py from .encoding import ( MinMaxNormalizer, Normalizer, OneHotEncoder, ProblemMaker, ReNormalizer, StandardNormalizer, ) from .outlier_filter import FilterNegative, FilterOutOfRange __all__ = [ "FilterNegative", "FilterOutOfRange", "One...
StarcoderdataPython
164084
<reponame>nick-furry/iree<filename>llvm-external-projects/iree-dialects/python/iree/compiler/dialects/iree_pydm/rtl/modules/macros.py # Copyright 2021 The IREE Authors # # Licensed under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: ...
StarcoderdataPython
168545
<reponame>ECE-492-W2020-Group-6/smart-blinds-rpi ''' File for blinds command related code. Commands are manual actions set by the user that are sent from the external application. These classes aim to model the command to more easily interact with the API. Contains classes: Also contains custom exception classes t...
StarcoderdataPython
1606088
<gh_stars>0 """replace date with data time in products Revision ID: c090bba0e451 Revises: <KEY> Create Date: 2021-02-25 09:39:10.272222 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '<KEY>' branch_labels = None depends_on = None def ...
StarcoderdataPython
3226559
from django import forms from django.core.exceptions import ValidationError def words_validators(comment): if len(comment) < 4: raise ValidationError('Not enough words') class CommentForm(forms.Form): name = forms.CharField(max_length=50) comment = forms.CharField( widget=forms.Textarea(...
StarcoderdataPython
139244
import io import os import time import argparse import random import logging import warnings import multiprocessing import numpy as np import mxnet as mx from mxnet import gluon from mxnet.gluon import Block, nn from mxnet.gluon.data.sampler import Sampler, SequentialSampler import gluonnlp as nlp from gluonnlp.model i...
StarcoderdataPython
3349990
<reponame>zccaayo/sumo # coding: utf-8 # Copyright (c) Scanlon Materials Theory Group # Distributed under the terms of the MIT License. """ This module provides a class for plotting density of states data. """ import itertools import matplotlib import matplotlib.pyplot from matplotlib.ticker import AutoMinorLocator ...
StarcoderdataPython
4829909
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from collections import namedtuple from flask import g from flask.ext.login import current_user from .user_permissions import UserPermissions from ggrc.app import db from ggrc.rbac.permissions import permiss...
StarcoderdataPython
1793935
# system library import numpy as np # user-library import RegressionBase # third-party library from sklearn import linear_model from sklearn.grid_search import GridSearchCV from sklearn.metrics import mean_squared_error class RegressionLinReg(RegressionBase.RegressionBase): def __init__(self, isTrain): ...
StarcoderdataPython
4834888
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: POGOProtos/Settings/Master/Item/EggIncubatorAttributes.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message f...
StarcoderdataPython
1728143
from nuclides import Nuclide Au196 = Nuclide('Au-196') print(Au196) What = Nuclide(Z=92, N=143) print(What.name) from nuclides import Element Ti = Element('Ti') print(Ti[46]) decays = Ti[59].decays for dec in decays: print(dec) T12 = Ti[44].decays[0].half_life BR = Ti[44].decays[0].branching_ratio print(f'T-44...
StarcoderdataPython
1709545
<reponame>jingshenSN2/CrystalTool # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'tabmatchresult.ui' # # Created by: PyQt5 UI code generator 5.9.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_tabmatchresult(object): def...
StarcoderdataPython
34921
<filename>InterAutoTest_W/testcase/t_pytest/pytest_class.py<gh_stars>1-10 #coding=utf-8 """ 1.定义类; 2.创建测试方法test开头 3.创建setup_class, teardown_class 4.运行查看结果 """ import pytest class TestClass(): def test_a(self): print('test_a') def test_b(self): print('test_b') def setup_class(self): ...
StarcoderdataPython
1691907
from project_name.schemas import EntityBase class Example(EntityBase): test: str class Config: orm_mode = True
StarcoderdataPython
3309359
from rest_framework import serializers from .models import (Teacher, Subject, Class, ) class TeacherSerializer(serializers.ModelSerializer): class Meta: model = Teacher fields = ['name', 'cpf', 'rg', 'phone_number', 'address', 'subject...
StarcoderdataPython
1754746
""" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ https://learn.sparkfun.com/tutorials/micropython-programming-tutorial-getting-started-with-the-esp32-thing/all #Intere LED EIN: import machine led = machine.Pin(2, machine.Pin.OUT) led.value(1) #Intere LED AUS: import machine l...
StarcoderdataPython
1654454
<gh_stars>10-100 import functools import itertools class Stream: """Stream pipeline API inspired by Java 8 stream""" def __init__(self, iterable, generator=next): self.iterator = iter(iterable) self.generator = generator def __iter__(self): return self def __next__(self): ...
StarcoderdataPython
1746020
"""Modify mesh vertex positions""" from vedo import * t = Text2D(__doc__) dsc = Disc().lineWidth(0.1) coords = dsc.points() for i in range(50): coords[:,2] = sin(i/10.*coords[:,0])/5 # move vertices in z dsc.points(coords) # modify mesh show(dsc, t, resetcam=not i, interactive=0, axes=7) # resetcam only...
StarcoderdataPython
3357296
<reponame>luk3yx/py-backwards from .. import ast from .base import BaseNodeTransformer class DictComprehensionTransformer(BaseNodeTransformer): """Compiles: d = {v: k for k, v in zip(range(10), range(10, 20))} To d = dict((v, k) for k, v in zip(range(10), range(10, 20))) """ target = ...
StarcoderdataPython
1762730
<reponame>imldresden/mcv-displaywall<filename>logging_base/study_logging.py<gh_stars>1-10 import logging, os from libavg import player from configs import config_app from configs.config_app import kinect_data_ip from configs.config_study import LoggingDefaults from logging_base.body_tracking.skeleton_manager import Sk...
StarcoderdataPython
3315743
#!/usr/bin/env python3 ############################################################################## # EVOLIFE http://evolife.telecom-paris.fr <NAME> # # Telecom Paris 2021 www.dessalles.fr # # ------------------------------------------------------------------------...
StarcoderdataPython
1762733
<reponame>Lossless-Virtual-Switching/Backdraft # Copyright (c) 2018, Nefeli Networks, Inc. # 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 the abov...
StarcoderdataPython
93904
# coding: utf-8 # Gather breast cancer data from sklearn.datasets import load_breast_cancer breast_cancer = load_breast_cancer() breast_cancer_data = breast_cancer.data breast_cancer_labels = breast_cancer.target # Prepare data as pandas dataframe import numpy as np labels = np.reshape(breast_cancer_labels,(569,1...
StarcoderdataPython
3227236
<reponame>meiry/Cocos2d-x-EarthWarrior3D-win-desktop-version #!/usr/bin/python # ---------------------------------------------------------------------------- # cocos2d "version" plugin # # Author: <NAME> # Copyright 2013 (C) Zynga, Inc # # License: MIT # -----------------------------------------------------------------...
StarcoderdataPython