id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3284621
<filename>ioflo/aid/test/test_eventing.py # -*- coding: utf-8 -*- """ Unit Test Template """ from __future__ import absolute_import, division, print_function import sys import datetime import unittest import os import time from ioflo.aid.sixing import * from ioflo.aid.odicting import odict from ioflo.test import tes...
StarcoderdataPython
59777
# # VAZ Projects # # # Author: <NAME> <<EMAIL>> from django.conf import settings MARKDOWN_FEATURES = getattr( settings, 'MARKDOWN_FEATURES', [ # Block. 'heading', 'html_block', 'list', # Inline. 'emphasis', 'html_inline', 'image', 'link', 'newline', ]) MARKDOWN_OPTIONS = getattr( settings, 'MARKDO...
StarcoderdataPython
180447
<gh_stars>0 import re from collections import namedtuple from itertools import combinations from queue import Queue from typing import Iterable, List, Set Rule = namedtuple('Rule', 'requires creates') class Relation: def __init__(self, elements=None, rules=None): self.rules = rules or [] # type: List[Ru...
StarcoderdataPython
3249495
from setuptools import setup, find_packages with open("README.md", "r") as readmefile: package_description = readmefile.read() setup( name="my-torch", version="0.0.6", author="<NAME>", author_email="<EMAIL>", description="A transparent boilerplate + bag of tricks to ease my (yours?) (our?) PyT...
StarcoderdataPython
1787574
<gh_stars>0 from __future__ import print_function import numpy as np from dynamic_graph.sot_talos_balance.dcm_controller import DcmController from numpy.testing import assert_almost_equal controller = DcmController("ciao") print("\nSignals (at creation):") controller.displaySignals() Kp = np.array([10.0, 10.0, 0.0]...
StarcoderdataPython
1600596
from flask_wtf import FlaskForm from wtforms import StringField, SubmitField, SelectField, TextAreaField, PasswordField, BooleanField from wtforms.validators import DataRequired, Regexp, EqualTo # 登录表单 class loginForm(FlaskForm): phone = StringField('电话号码', validators=[DataRequired()]) password = PasswordFiel...
StarcoderdataPython
1758326
# -*- coding: utf-8 -*- """Implementation of the ``somatic_target_seq_cnv_calling`` step This step allows for the detection of CNV events for cancer samples from targeted sequenced (e.g., exomes or large panels). The wrapped tools start from the aligned reads (thus off ``ngs_mapping``) and generate CNV calls for soma...
StarcoderdataPython
1764717
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (o...
StarcoderdataPython
3287787
/home/sheldon/anaconda3/lib/python3.6/enum.py
StarcoderdataPython
111735
from __future__ import print_function, absolute_import from collections import OrderedDict from ._result_base import H5NastranResultBase from h5Nastran.post_process.result_readers.punch import PunchReader import numpy as np import tables from six import iteritems class H5NastranResultPunch(H5NastranResultBase): ...
StarcoderdataPython
3311423
from __future__ import print_function import numpy as np import random try: xrange except NameError: xrange = range class DataLoader: def __init__(self, mbsz=128, min_len=20, max_len=30, num_classes=29): self.mbsz = mbsz self.min_len = min_len self.max_len = max_len self.n...
StarcoderdataPython
4835487
<reponame>ajeet1308/code_problems // https://www.spoj.com/problems/TMUL/ n = int(input()) arr = [ ] for i in range(0,n): a,b= input().split() arr.append(int(a)*int(b)) for num in arr: print(num)
StarcoderdataPython
1699459
<reponame>OsiriX-Foundation/IntegrationTest import rq_album import rq_user import env import util import random import string import rq_studies def test_init(): env.initialize() print() def test_get_token(): print() token = util.get_token(username="titi", password="<PASSWORD>") env.env_var["USER_...
StarcoderdataPython
3222263
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proto/grid/messages/success_resp_message.proto """Generated protocol buffer code.""" # third party from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from googl...
StarcoderdataPython
3368708
<reponame>jKulrativid/DNA_cut_for_grade_XII<filename>CODE/usage_class.py class DNA: def __init__(self, strand, direction): self.name = 'Unnamed DNA' self.strand = strand.upper() self.start = direction[0] + '\'' self.stop = direction[3] + '\'' self.a, self.t, self.c, self.g, s...
StarcoderdataPython
1676008
import abc import itertools import numpy as np from keras.preprocessing.image import apply_affine_transform class AffineTransformation(object): def __init__(self, flip, tx, ty, k_90_rotate): self.flip = flip self.tx = tx self.ty = ty self.k_90_rotate = k_90_rotate def __call_...
StarcoderdataPython
1710348
<filename>TP1/zip2/main.py import math import random import time import matplotlib.pyplot as pyplot from matplotlib.pyplot import Figure, subplot from smallestenclosingcircle import make_circle def search(Positions, k, c): solution = greedy_solution(Positions, k, c) meilleur = solution T = 500.0 thet...
StarcoderdataPython
3302497
from entangled.forms import EntangledModelForm from djangocms_frontend.fields import AttributesFormField, TagTypeFormField from ...common.responsive import ResponsiveFormMixin from ...models import FrontendUIItem class MediaForm(ResponsiveFormMixin, EntangledModelForm): """ Layout > "Media" Plugin http:...
StarcoderdataPython
1746698
<reponame>shilpasayura/bk def merge(xs, ys): # return a sorted list with the merged contents of the sorted lists xs and ys i = 0 j = 0 zs = [] while not (i == len(xs) or j == len(ys)): if xs[i] < ys[j]: zs.append(xs[i]) i = i + 1 else: zs.append(ys...
StarcoderdataPython
88718
from dataclasses import dataclass @dataclass class Vehicle: name: str model: str max_speed: int
StarcoderdataPython
1626972
<filename>app.py from flask import Flask, request from flask_cors import CORS import apis app = Flask(__name__) cors = CORS(app, resource={'/v1/GET/*': {"origin": "*"}}) @app.route('/') def hello_world(): return 'Hello World!' @app.route('/v1/GET/stu_grade_score/<ID>', methods=['GET', 'POST']) de...
StarcoderdataPython
64819
<filename>__init__.py<gh_stars>0 from mycroft import MycroftSkill, intent_file_handler class Whyplessey(MycroftSkill): def __init__(self): MycroftSkill.__init__(self) @intent_file_handler('whyplessey.intent') def handle_whyplessey(self, message): self.speak_dialog('whyplessey') def crea...
StarcoderdataPython
3246112
# -*- coding: utf-8 -*- from .version import version_info, __version__ from .highcharts.highcharts import Highchart from .highmaps.highmaps import Highmap from .highstock.highstock import Highstock from . import ipynb
StarcoderdataPython
1683259
"""Export constants shared by all classes of the module.""" from sys import maxint # Actions (from /usr/include/net/pfvar.h) PF_PASS = 0 PF_DROP = 1 PF_SCRUB = 2 PF_NOSCRUB = 3 PF_NAT = 4 PF_NONAT = 5 PF_BINAT ...
StarcoderdataPython
3237398
# -*- coding: utf-8 -*- """ Created on Sat Nov 25 11:39:15 2017 @author: Administrator """ import matplotlib.pyplot as plt #使用import导入模块matplotlib.pyplot,并简写成plt import numpy as np #使用import导入模块numpy,并简写成np import plotly as py # 导入plotly库并命名为py # -------------pre def pympl = py.offline.plot_mpl # 配置中文显示 plt.rcPara...
StarcoderdataPython
73912
import os from torch.utils.data import Dataset from facade_project import LABEL_NAME_TO_VALUE from facade_project.utils.load import load_tuple_from_json class FacadeLabelmeDataset(Dataset): """ Facade Labelme Dataset A dataset which loads labelme style json files within a directory. Items of the d...
StarcoderdataPython
1711292
from tkinter import * from functools import partial class Program: def __init__(self, master, contents): self.buttons = [] self.last_highlight = None self.breakpoints = set() frame = LabelFrame(master, text="Program") frame.pack(side=TOP, anchor=W, padx=2, fill=X) ...
StarcoderdataPython
133020
#!/usr/bin/env python # coding: utf8 import asyncio import datetime import json import os import subprocess import time from sys import platform from requests import get from colorama import Fore, init with open('settings.json', 'r') as settings: settings = json.load(settings) async def clear(): ...
StarcoderdataPython
69858
#!/usr/bin/env python # # Author: <NAME> <<EMAIL>> # ''' Some hacky functions ''' import os, sys import imp import tempfile import shutil import functools import itertools import math import ctypes import numpy import h5py from pyscf.lib import param c_double_p = ctypes.POINTER(ctypes.c_double) c_int_p = ctypes.POIN...
StarcoderdataPython
197223
<gh_stars>0 from setuptools import setup, find_packages from mezzanine_youth_sports import __version__ import subprocess def get_long_desc(): """Use Pandoc to convert the readme to ReST for the PyPI.""" try: return subprocess.check_output(['pandoc', '-f', 'markdown', '-t', 'rst', 'README.md']) exce...
StarcoderdataPython
3260058
<reponame>pybpod/pybpod-gui-plugin-soundcard import os SOUNDCARD_PLUGIN_ICON = os.path.join(os.path.dirname(__file__), 'resources', 'sound-card.png') SOUNDCARD_PLUGIN_WINDOW_SIZE = 500, 600
StarcoderdataPython
1786938
try: from IPython.core import DataMetadata, RecursiveObject, ReprGetter, get_repr_mimebundle except ImportError: from collections import namedtuple class RecursiveObject: """ Default recursive object that provides a recursion repr if needed. You may register a formatter for this o...
StarcoderdataPython
1777731
<filename>src/endpoints/order.py import oandapyV20.endpoints.orders as orders from connection import Connection import json class Order: conn = Connection.getInstance() accountID = conn.config['ACCOUNT_ID'] def __init__(self, units, instrument): with open('src/orderbody.json', 'r') as f: dat...
StarcoderdataPython
48728
# -*- coding: utf-8 -*- # # Copyright (C) 2015 Edgewall Software # Copyright (C) 2015 <NAME> <<EMAIL>> # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edgewall.com/...
StarcoderdataPython
1607843
from setuptools import setup, find_packages from codecs import open import importlib import os root = os.path.abspath(os.path.dirname(__file__)) # Get the long description from the README file with open(os.path.join(root, 'README.md'), encoding='utf-8') as f: long_description = f.read() # Load the version numbe...
StarcoderdataPython
123109
import urlparse from urllib import urlencode from django.conf import settings import jwt from mozpay.verify import verify_claims, verify_keys from nose.tools import eq_ import amo from amo.helpers import absolutify from amo.urlresolvers import reverse from mkt.webpay.webpay_jwt import (get_product_jwt, WebAppProduct...
StarcoderdataPython
3380974
# Generated by Django 3.0.5 on 2021-05-31 19:04 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('quiz', '0006_auto_20210531_2004'), ] operations = [ migrations.AlterField( model_name='course', name...
StarcoderdataPython
3329689
class ProductPackaging(object): def __init__(self, packaging, packaging_tags, emb_codes, emb_codes_tags, first_packaging_code_geo): self.Packaging = packaging self.PackagingTags = packaging_tags self.EmbCodes = emb_codes self.EmbCodesTags = emb_codes_tags self.FirstPackaging...
StarcoderdataPython
3382740
#!/usr/bin/python def leerDato(): import urllib2 html = urllib2.urlopen('http://ip.42.pl/raw').read() return html print leerDato() print ":)"
StarcoderdataPython
3347266
<reponame>rgmyr/litholog<gh_stars>10-100 """ IO classes & functions. This is an incomplete implemention of a more general/customizable implementation of data checking/pre-processing. """ import operator from abc import abstractmethod import pandas as pd from litholog import utils class BaseCheck(): """ Bas...
StarcoderdataPython
178304
# 实现PCA分析和法向量计算,并加载数据集中的文件进行验证 import os import time import numpy as np from pyntcloud import PyntCloud import open3d as o3d def PCA(data: PyntCloud.points, correlation: bool=False, sort: bool=True) -> np.array: """ Calculate PCA Parameters ---------- data(PyntCloud.points): 点云,NX3的矩阵 co...
StarcoderdataPython
3286275
<reponame>igorcosta/bidu import pytest from bidu.utils.test_utils import layer_test, bidu_test from bidu.layers import noise @bidu_test def test_GaussianNoise(): layer_test(noise.GaussianNoise, kwargs={'sigma': 1.}, input_shape=(3, 2, 3)) @bidu_test def test_GaussianDropout(): ...
StarcoderdataPython
3319385
from observer import AbsSubject class MySubject(AbsSubject): _foo = -1 _bar = -1 @property def foo(self): return self._foo @property def bar(self): return self._bar def set_states(self, new_foo, new_bar): self._foo = new_foo self._bar = new_ba...
StarcoderdataPython
3270226
<reponame>windniw/just-for-fun<gh_stars>1-10 """ link: https://leetcode-cn.com/problems/trapping-rain-water-ii problem: 给二维矩阵代表每个点的高度,向其最大的保留水量,设周围高度为0 solution: 维护边沿,用最小堆每次抛出边缘的最小值,依次向内收缩做搜索。 """ class Solution: def trapRainWater(self, heightMap: List[List[int]]) -> int: if not heightMap or not height...
StarcoderdataPython
1718174
<filename>Visual/model.py<gh_stars>1-10 import torch.nn.functional as F import torch.optim as optim import torch.nn as nn import torch class QNetwork(nn.Module): def __init__(self, action_size, seed): super(QNetwork, self).__init__() nfilters = [128, 128*2, 128*2] self.seed = torch.manual_s...
StarcoderdataPython
1643817
<gh_stars>0 import plotly import plotly.express as px from plotly.missing_ipywidgets import FigureWidget import pandas as pd token = "<KEY>" def show_bush_fires(df: pd.DataFrame): px.set_mapbox_access_token(token) fig = px.scatter_mapbox(df, lat='latitude', lon='longitude', color='ranking', title="Wildfires i...
StarcoderdataPython
3394347
import asyncio from collections import defaultdict from functools import wraps from pengbot import logger from pengbot.context import Context from pengbot.utils import isbound class UnknownCommand(Exception): pass class BaseAdapter: handlers = [] signals = {} running = False name = None loo...
StarcoderdataPython
1644277
<filename>5.analysis/scikit-multilearn-master/skmultilearn/problem_transform/cc.py from builtins import range from ..base.problem_transformation import ProblemTransformationBase from scipy.sparse import hstack, coo_matrix, issparse import copy import numpy as np import random class ClassifierChain(ProblemTransformati...
StarcoderdataPython
185491
#!/usr/bin/env python # -*- coding: utf-8 -*- # BEGIN LICENSE # Copyright (c) 2014 <NAME> <<EMAIL>> # Copyright (c) 2017 <NAME> <<EMAIL>> # 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 with...
StarcoderdataPython
1663782
from . import analysis, config, modeling, preproc, save_load, train_repeated_model, train_repeated_model_binary, \ train_single_model, train_single_model_binary, train_single_model_cv __all__ = [analysis, config, modeling, preproc, save_load, train_repeated_model, train_repeated_model_binary, train_sing...
StarcoderdataPython
1797408
from disposable_email_domains import whitelist def test_whitelist_inclusion(): assert 'spamcannon.com' in whitelist def test_whitelist_exclusion(): assert 'spamcowboy.com' not in whitelist
StarcoderdataPython
107676
import csv import os from clients.models import Client class ClientsServices(): def __init__(self, database) -> None: self.database = database self.database_tmp = f'{database}.tmp' def create_client(self, client): with open(self.database, mode='a') as f: writer = csv.DictW...
StarcoderdataPython
15514
<filename>llist_gameboard/urls.py """ URL's for the LList Game Board app. """ from django.urls import path from llist_gameboard.api import llist_api from . import views urlpatterns = [ # Views path('', views.llist_game_board, name='llist-game-board'), #Game Play API Calls For Linked List path('l...
StarcoderdataPython
3273750
<filename>NamingConvention/NamingConventionTests/NameCompliance.py #! /usr/bin/python import re import sys #Description: Checks a string against the standard naming conventions. #Author: <NAME> #Date: 25/10/17 #Authorised by: #Last Modified: 17/11/17 #Audit Log: #Notes: Returns error messages as a string or an empty...
StarcoderdataPython
1777292
<reponame>eons-dev/build_cpp import os import logging import shutil import jsonpickle from distutils.file_util import copy_file from distutils.dir_util import copy_tree, mkpath from ebbs import Builder # Class name is what is used at cli, so we defy convention here in favor of ease-of-use. class cpp(Builder): def...
StarcoderdataPython
1775546
import os from pathlib import Path class Initialize: def __init__(self, config, database, sql): self.home = str(Path.home()) self.database = database self.sql = sql self.config = config data_path = self.home+'/core3-tbw/core/data/tbw.db' if os.path.exists(da...
StarcoderdataPython
163479
<gh_stars>0 from django.contrib.auth.decorators import login_required from django.shortcuts import redirect from django.views.generic import TemplateView from rooms import models as room_models from . import models @login_required def toggle_room(request, room_pk): action = request.GET.get("action", None) room...
StarcoderdataPython
1798165
""" Exception types used by powercmd module. """ class InvalidInput(ValueError): """An error raised if the input cannot be parsed as a valid command."""
StarcoderdataPython
3313253
''' Write a program that takes an array A of n numbers, and rearranges A's elements to get a new array B having the property that: B[0] < B[1] > B[2] < B[3] > B[4] < B[5] > ... ''' def rearrange(array): # Time: O(n) for i in range(len(array) - 1): if ((i % 2 and array[i] < array[i + 1]) or ...
StarcoderdataPython
115451
<filename>ui_shapeFlow.py # -*- coding: utf-8 -*- # GUI for shapeFlow and ShapeMatching Maya plugins # How To Use: # 1. in script editor # import plugin_deformer.ui_shapeFlow as ui # reload(ui) # ui.UI_Gradient() # # 2. Select target mesh and then shift+click to select the end mesh. # 3. Create deformer from m...
StarcoderdataPython
3221990
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import print_function import warnings from six import BytesIO from astropy.table import Table from astropy.io import fits from astropy import coordinates from astropy import units as u from ..query import BaseQuery from ..utils import commo...
StarcoderdataPython
1756740
<reponame>HMProenca/RuleList<filename>tests/rulelistmodel/test_rulelsetmodel.py import numpy as np import pandas as pd import pytest from gmpy2 import mpz, bit_mask from rulelist.datastructure.data import Data from rulelist.rulelistmodel.rulesetmodel import RuleSetModel @pytest.fixture def constant_parameters(): ...
StarcoderdataPython
3391019
from __future__ import annotations from abc import ABC, abstractmethod from typing import Any class Builder(ABC): """ The Builder interface specifies methods for creating the different parts of the Product objects. """ @property @abstractmethod def product(self) -> None: pass ...
StarcoderdataPython
28481
# Copyright European Organization for Nuclear Research (CERN) # # 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 # # Authors: # - <NAME>, <<EMAIL>>, 20...
StarcoderdataPython
3374869
#!/usr/bin/python # -- Content-Encoding: UTF-8 -- """ Tests remote services discovery using the JSON-RPC transport :author: <NAME> :copyright: Copyright 2020, <NAME> :license: Apache License 2.0 .. Copyright 2020 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this...
StarcoderdataPython
3338386
<gh_stars>1-10 import unittest from unittest.mock import Mock from importlib import import_module component = import_module('run.helpers.impobj') class import_object_Test(unittest.TestCase): # Tests def test(self): self.assertIs( component.import_object('unittest.mock.Mock'), Mock) ...
StarcoderdataPython
4802496
""" clustering of word embeddings @TODO documentation of the module """ import numpy as np from sklearn.base import BaseEstimator from gensim.models import Word2Vec, KeyedVectors from sklearn.decomposition import PCA from sklearn.cluster import KMeans class WordClustering(BaseEstimator): """ theme-affinity vect...
StarcoderdataPython
176763
<reponame>vandurme/TFMTL<filename>mtl/extractors/lbirnn.py<gh_stars>1-10 # Copyright 2018 Johns Hopkins University. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
StarcoderdataPython
3204504
<filename>ax/service/tests/test_global_stopping.py # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Dict, Tuple import numpy as np from ax.core.types import TParameteriz...
StarcoderdataPython
3299023
from .converter import BaseConverter from .exceptions import AnnotationConversionError, MarshmallowAnnotationError from .registry import TypeRegistry, field_factory, registry, scheme_factory from .scheme import AnnotationSchema, AnnotationSchemaMeta __version__ = "2.4.1" __author__ = "<NAME>" __license__ = "MIT"
StarcoderdataPython
3292825
<gh_stars>10-100 import numpy as np import tensorflow as tf import copy import elbo.util as util from elbo.joint_model import Model, MovingAverageStopper from grammar import list_successors from models import build_model class ExperimentSettings(object): def __init__(self): self.gaussian_auto_ard = T...
StarcoderdataPython
128823
<filename>profile_generator/model/faded.py import math from profile_generator.unit import Curve def curve(offset: float, slope: float) -> Curve: fade_end = 3 * offset / (2 - 2 * slope) a = (1 - offset / fade_end - slope) / math.pow(fade_end, 2) b = 0 c = slope d = offset def _curve(x: float)...
StarcoderdataPython
3313853
from osgeo import gdal import os import sys import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd country = 'denmark' if country == 'france': geotif_2015 = gdal.Open(r'C:\Users\Niels\Documents\GitHub\PopNet\data\france\2015.tif') geotif_2020 = gdal.Open(r'C:\Users\Niels\...
StarcoderdataPython
27574
from allauth.account.forms import LoginForm as AllauthLoginForm class LoginForm(AllauthLoginForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) del self.fields["login"].widget.attrs["placeholder"] del self.fields["password"].widget.attrs["placeholder"]
StarcoderdataPython
4815022
<reponame>opennode/opennode-tui<gh_stars>1-10 """ Forms for OpenNode Terminal User Interface """ import operator from snack import Textbox, Button, GridForm from opennode.cli.fields import FloatField, IntegerField, StringField from opennode.cli.fields import PasswordField, IpField, RadioBarField from opennode.cli.fi...
StarcoderdataPython
3229844
#!/usr/bin/env python3 import json import os import subprocess import argparse import getpass from base64 import b64encode from collections import namedtuple def get_args(): """Parse any command line arguments""" parser = argparse.ArgumentParser() parser.add_argument("--url", default="", help="the Jamf ...
StarcoderdataPython
3215701
# -*- coding: utf-8 -*- from hashlib import sha512 from openprocurement.api.utils import ( json_view, APIResource, save_tender, ROUTE_PREFIX, context_unpack ) from openprocurement.tender.openeu.utils import qualifications_resource from openprocurement.relocation.api.utils import ( extract_transf...
StarcoderdataPython
3308010
<gh_stars>10-100 import os from glob import glob import yaml from jinja2 import Environment, FileSystemLoader, StrictUndefined BASE_PATH = os.path.dirname(__file__) or "." LIST_EXAMPLES_PATH = "{}/../test/unit/test_parser/list/".format(BASE_PATH) LIST_EXAMPLES = sorted([x for x in glob("{}/*".format(LIST_EXAMPLES_...
StarcoderdataPython
3261990
<gh_stars>0 from setuptools import setup, Extension from torch.utils import cpp_extension import os module_path = os.path.dirname(__file__) setup(name='op_cpp', ext_modules=[cpp_extension.CUDAExtension(name="fused", sources=["fused_bias_act.cpp", "fused_bias_act_kernel.cu"], include_di...
StarcoderdataPython
1666332
#!/usr/bin/env python # encoding: utf-8 from __future__ import unicode_literals import itertools import datetime import logging from collections import OrderedDict, namedtuple import scraperwiki from table_names import _RAW_SALES_TABLE _SECTOR_NAME = { 'central-gov': 'Central government', 'local-g...
StarcoderdataPython
3273614
<reponame>edmondchuc/oxigraph-admin<filename>oxigraph_admin/api/api_v1/endpoints/security.py from fastapi import APIRouter, Body from fastapi.responses import JSONResponse from oxigraph_admin import crud from oxigraph_admin.schemas.security import SecuritySettings router = APIRouter() @router.get('/security', respo...
StarcoderdataPython
3208450
<reponame>Eric-Muthemba/qontroverse # -*- coding: utf-8 -*- model = { u'yn ': 0, u'dd ': 1, u' yn': 2, u' y ': 3, u'ydd': 4, u'eth': 5, u'th ': 6, u' i ': 7, u'aet': 8, u'd y': 9, u'ch ': 10, u'od ': 11, u'ol ': 12, u'edd': 13, u' ga': 14, u' gw': 15, u"'r ": 16, u'au ': 17, u'ddi': 18, u'ad ': 19, ...
StarcoderdataPython
54278
<reponame>tamasf97/Platform __all__ = ['models', 'api']
StarcoderdataPython
135747
from abc import ABC from typing import Optional from cogbot.cogs.robo_mod.robo_mod_action_log_entry import RoboModActionLogEntry from cogbot.cogs.robo_mod.robo_mod_trigger import RoboModTrigger from cogbot.lib.dict_repr import DictRepr class RoboModAction(ABC, DictRepr): async def init(self, state: "RoboModServe...
StarcoderdataPython
171483
<reponame>drtnf/cits3403-pair-up<gh_stars>1-10 import unittest, os, time from app import app, db from app.models import Student, Project, Lab from selenium import webdriver basedir = os.path.abspath(os.path.dirname(__file__)) #To do, find simple way for switching from test context to development to production. class...
StarcoderdataPython
3347764
<filename>Sentiment_API_Server/DSFunctions.py '''Functions for actions in the Tweet Better website.''' '''TODO: present the score (-1 to 1) as a percentage (0 is 50%)''' '''TODO: is it necessary on DS part to make a plot.ly graphing function? To retrieve stuff from the API?''' #imports import string from stri...
StarcoderdataPython
194408
import boto3 import logging import os def lambda_handler(event, context): logger = logging.getLogger() logger.setLevel(logging.INFO) region = os.environ['AWS_REGION'] ec2 = boto3.client('ec2', region_name=region) cidr_blocks = event['cidr_blocks'] tgw_route_table_id = event['tgw_route_table...
StarcoderdataPython
114302
<reponame>ciholas/cdp-geofencing # Ciholas, Inc. - www.ciholas.com # Licensed under: creativecommons.org/licenses/by/4.0 class Zone: """A zone in the form of a polygon""" def __init__(self, name, vertices, color): self.name = name self.vertices = vertices self.color = color x_...
StarcoderdataPython
4821209
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- import pandas as pd from bs4 import BeautifulSoup import json import os from pprint import pprint import datetime as dt import geopy from geopy.geocoders import GoogleV3 from geopy.exc import GeocoderTimedOut def main(): geolocator = GoogleV3(api_ke...
StarcoderdataPython
30985
<gh_stars>0 """A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html """ from setuptools import setup, find_packages from codecs import open from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encoding='utf-8') as f: ...
StarcoderdataPython
1789182
import time import datetime import numpy as np from sklearn.metrics import f1_score import random import torch import pandas as pd from sklearn.preprocessing import LabelEncoder from sklearn.pipeline import Pipeline import os # Function to set the random seeds for reproducibility def fix_the_random(seed_val = 42): ...
StarcoderdataPython
77027
<gh_stars>0 import unittest from unittest import mock from wp.exceptions import WordSizeException, WordNotInWordListException, ImpossiblePathException from wp.main import WordPath def create_mock_open(file_text): # mock_open does not implement iteration on return object as 'open' do m_open = mock.mock_open(...
StarcoderdataPython
126237
<filename>motion_analysis/gui/layout/motion_modelling_dialog_ui.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'D:\Research\physics\workspace\mosi_app_mgtools\motion_analysis\GUI\layout\.\motion_modelling_dialog.ui', # licensing of 'D:\Research\physics\workspace\mosi_app_mgtools\motion...
StarcoderdataPython
120583
import bisect import copy import datetime import uuid import operator import pytz import calendar from elasticsearch_dsl.query import Range, Terms def string_to_datetime(timestamp): try: return datetime.datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%fZ") except ValueError: return datetime.da...
StarcoderdataPython
63321
print '... Importing simuvex/engines/vex/expressions/get.py ...' from angr.engines.vex.expressions.get import *
StarcoderdataPython
4820190
<filename>GNS3/ConfigParsers/cisco_ios.py import re # Regex to find the host name hostname_cisco_regex = re.compile(r'hostname\s+(?P<name>\S+)') # Regex to find interface definitions as well as assigned addresses interface_cisco_regex = re.compile( r'interface\s+FastEthernet(?P<adapter>\d)/(?P<port>\d)(?!\n no ip ...
StarcoderdataPython
3211546
<gh_stars>0 from os import write import sympy n = 13 def prime_test(number, witness): if witness >= number: raise ValueError("witness must be smaller than the number") elif number % 2 == 0: return False factor = (number - 1)/2 d = 1 while factor % 2 == 0: d += 1 factor = factor / 2 fac...
StarcoderdataPython
89648
#!/usr/bin/env python # Copyright (c) 2014, Robot Control and Pattern Recognition Group, Warsaw University of Technology # 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 o...
StarcoderdataPython
3276229
<filename>src/figtag/apps/run.py from typing import Any from figtag.manage import Cog from figtag.run import run import logging from os import environ class Runner(Cog): # pragma: no cover @staticmethod def initialize(arg_parse: Any) -> None: parser = arg_parse.add_parser( "run", ...
StarcoderdataPython
1742523
<filename>examples/python/misc/realsense.py # Open3D: www.open3d.org # The MIT License (MIT) # See license file or visit www.open3d.org for details # examples/python/misc/realsense.py # Simple example to show RealSense camera discovery and frame capture import open3d as o3d if __name__ == "__main__": o3d.t.io....
StarcoderdataPython