max_stars_repo_path stringlengths 4 286 | max_stars_repo_name stringlengths 5 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.03M | content_cleaned stringlengths 6 1.03M | language stringclasses 111
values | language_score float64 0.03 1 | comments stringlengths 0 556k | edu_score float64 0.32 5.03 | edu_int_score int64 0 5 |
|---|---|---|---|---|---|---|---|---|---|---|
data_processing/process_xls.py | luisroel91/libdib_assesment | 0 | 8300 | import pandas as pd
# Define our header
col_names = [
"year",
"num_males_with_income",
"male_median_income_curr_dollars",
"male_median_income_2019_dollars",
"num_females_with_income",
"female_median_income_curr_dollars",
"female_median_income_2019_dollars",
]
# Load Asian census data XLS, ... | import pandas as pd
# Define our header
col_names = [
"year",
"num_males_with_income",
"male_median_income_curr_dollars",
"male_median_income_2019_dollars",
"num_females_with_income",
"female_median_income_curr_dollars",
"female_median_income_2019_dollars",
]
# Load Asian census data XLS, ... | en | 0.843256 | # Define our header # Load Asian census data XLS, skipping all headers # Make sure PD doesn't use header row for our DF # Define col names # Load White census data XLS, skipping all headers # Make sure PD doesn't use header row for our DF # Define cold names # Splinter off rows into age group DFs for both sets of data ... | 3.22333 | 3 |
Section_1/Exercise_16.py | Szymon-Budziak/WDI_exercises_solutions | 0 | 8301 | """
Dany jest ciąg określony wzorem: A[n+1] = (A[n] % 2) ∗ (3 ∗ A[n] + 1) + (1 − A[n] % 2) ∗ A[n] / 2.
Startując z dowolnej liczby naturalnej > 1 ciąg ten osiąga wartość 1. Napisać program, który
znajdzie wyraz początkowy z przedziału 2-10000 dla którego wartość 1 jest osiągalna po największej
liczbie kroków.
"""
a0 = ... | """
Dany jest ciąg określony wzorem: A[n+1] = (A[n] % 2) ∗ (3 ∗ A[n] + 1) + (1 − A[n] % 2) ∗ A[n] / 2.
Startując z dowolnej liczby naturalnej > 1 ciąg ten osiąga wartość 1. Napisać program, który
znajdzie wyraz początkowy z przedziału 2-10000 dla którego wartość 1 jest osiągalna po największej
liczbie kroków.
"""
a0 = ... | pl | 0.998092 | Dany jest ciąg określony wzorem: A[n+1] = (A[n] % 2) ∗ (3 ∗ A[n] + 1) + (1 − A[n] % 2) ∗ A[n] / 2. Startując z dowolnej liczby naturalnej > 1 ciąg ten osiąga wartość 1. Napisać program, który znajdzie wyraz początkowy z przedziału 2-10000 dla którego wartość 1 jest osiągalna po największej liczbie kroków. | 3.019995 | 3 |
SysPy_ver/funcs/_var_declaration.py | evlog/SysPy | 4 | 8302 | <filename>SysPy_ver/funcs/_var_declaration.py
"""
*****************************************************************************
*
H E A D E R I N F O R M A T I O N *
... | <filename>SysPy_ver/funcs/_var_declaration.py
"""
*****************************************************************************
*
H E A D E R I N F O R M A T I O N *
... | en | 0.531553 | ***************************************************************************** * H E A D E R I N F O R M A T I O N * * ********... | 1.561566 | 2 |
Giraffe/Functions.py | MaggieIllustrations/softuni-github-programming | 0 | 8303 | def say_hi(name,age):
print("Hello " + name + ", you are " + age)
say_hi("Mike", "35")
def cube(num): # function
return num*num*num
result = cube(4) # variable
print(result)
| def say_hi(name,age):
print("Hello " + name + ", you are " + age)
say_hi("Mike", "35")
def cube(num): # function
return num*num*num
result = cube(4) # variable
print(result)
| en | 0.193963 | # function # variable | 3.507782 | 4 |
airspace_surgery.py | wipfli/airspaces | 1 | 8304 | <gh_stars>1-10
import glob
import json
path_in = './airspaces/'
path_out = './airspaces_processed/'
filenames = [path.split('/')[-1] for path in glob.glob(path_in + '*')]
remove = {
'france_fr.geojson': [
314327,
314187,
314360,
314359,
314362,
314361,
3143... | import glob
import json
path_in = './airspaces/'
path_out = './airspaces_processed/'
filenames = [path.split('/')[-1] for path in glob.glob(path_in + '*')]
remove = {
'france_fr.geojson': [
314327,
314187,
314360,
314359,
314362,
314361,
314364,
314... | none | 1 | 2.387058 | 2 | |
AndroidSpider/spider_main.py | lidenghong1/SmallReptileTraining | 1 | 8305 | from AndroidSpider import url_manager, html_downloader, html_parser, html_output
'''
爬取百度百科 Android 关键词相关词及简介并输出为一个HTML tab网页
Extra module:
BeautifulSoup
'''
class SpiderMain(object):
def __init__(self):
self.urls = url_manager.UrlManager()
self.downloader = html_downloader.HtmlDownLoader()
... | from AndroidSpider import url_manager, html_downloader, html_parser, html_output
'''
爬取百度百科 Android 关键词相关词及简介并输出为一个HTML tab网页
Extra module:
BeautifulSoup
'''
class SpiderMain(object):
def __init__(self):
self.urls = url_manager.UrlManager()
self.downloader = html_downloader.HtmlDownLoader()
... | zh | 0.595744 | 爬取百度百科 Android 关键词相关词及简介并输出为一个HTML tab网页 Extra module: BeautifulSoup | 2.966678 | 3 |
trompace/mutations/__init__.py | trompamusic/ce-queries-template | 1 | 8306 | MUTATION = '''mutation {{
{mutation}
}}'''
def _verify_additional_type(additionaltype):
"""Check that the input to additionaltype is a list of strings.
If it is empty, raise ValueError
If it is a string, convert it to a list of strings."""
if additionaltype is None:
return None
if isins... | MUTATION = '''mutation {{
{mutation}
}}'''
def _verify_additional_type(additionaltype):
"""Check that the input to additionaltype is a list of strings.
If it is empty, raise ValueError
If it is a string, convert it to a list of strings."""
if additionaltype is None:
return None
if isins... | en | 0.810291 | mutation {{ {mutation} }} Check that the input to additionaltype is a list of strings. If it is empty, raise ValueError If it is a string, convert it to a list of strings. | 2.809383 | 3 |
Web_App/infrastructure/infra.py | CapitalOneDevExchangeHackathon/Financial-Fitness | 0 | 8307 | import boto
import boto3
from config import Config
dynamodb = boto3.resource('dynamodb',
aws_access_key_id=Config.AWS_KEY,
aws_secret_access_key=Config.AWS_SECRET_KEY,
region_name=Config.REGION)
table = dynamodb.Table('user_details')
tables... | import boto
import boto3
from config import Config
dynamodb = boto3.resource('dynamodb',
aws_access_key_id=Config.AWS_KEY,
aws_secret_access_key=Config.AWS_SECRET_KEY,
region_name=Config.REGION)
table = dynamodb.Table('user_details')
tables... | none | 1 | 2.558914 | 3 | |
numberTheory/natural.py | ndarwin314/symbolicPy | 0 | 8308 | <reponame>ndarwin314/symbolicPy<filename>numberTheory/natural.py
# TODO: implement algorithms in c++ or something to make them fast
| # TODO: implement algorithms in c++ or something to make them fast | en | 0.827268 | # TODO: implement algorithms in c++ or something to make them fast | 1.102762 | 1 |
SelfTests.py | TeaPackCZ/RobotZed | 0 | 8309 | <filename>SelfTests.py
import os
import unittest
from Logger import Logger
class TestLogger(unittest.TestCase):
def test_file_handling(self):
testLog = Logger("testLog")
## Check if program can create and open file
self.assertTrue(testLog.opened)
returns = testLog.close()
##... | <filename>SelfTests.py
import os
import unittest
from Logger import Logger
class TestLogger(unittest.TestCase):
def test_file_handling(self):
testLog = Logger("testLog")
## Check if program can create and open file
self.assertTrue(testLog.opened)
returns = testLog.close()
##... | en | 0.627601 | ## Check if program can create and open file ## Check if logger correctly signs bool OPENED and returns ## 0 as succes. ## Check if logger returns 1 when trying to close already ## closed file ## Do cleanup: ## Check if saved data corresponds ## cleanup | 3.248226 | 3 |
manga_py/parser.py | Abijithkrishna/manga-py | 0 | 8310 | from logging import warning
from requests import get
from .info import Info
from .provider import Provider
from .providers import get_provider
class Parser:
def __init__(self, args: dict):
self.params = args
def init_provider(
self,
chapter_progress: callable = None,
... | from logging import warning
from requests import get
from .info import Info
from .provider import Provider
from .providers import get_provider
class Parser:
def __init__(self, args: dict):
self.params = args
def init_provider(
self,
chapter_progress: callable = None,
... | it | 0.268926 | # update url (if redirect) # type: Provider | 2.346423 | 2 |
src/villages/migrations/0008_auto_20161228_2209.py | pwelzel/bornhack-website | 0 | 8311 | <filename>src/villages/migrations/0008_auto_20161228_2209.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-28 22:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('villages', '0007_village_camp'),
... | <filename>src/villages/migrations/0008_auto_20161228_2209.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-28 22:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('villages', '0007_village_camp'),
... | en | 0.787238 | # -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2016-12-28 22:09 | 1.450286 | 1 |
customers/views.py | sindhumadhadi09/CustomerMgmt | 0 | 8312 | <reponame>sindhumadhadi09/CustomerMgmt
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.views import generic
from django.utils import timezone
from .models import Customer
class IndexView(generic.ListView):
template_nam... | from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.views import generic
from django.utils import timezone
from .models import Customer
class IndexView(generic.ListView):
template_name = 'customers/index.html'
context_... | none | 1 | 2.181892 | 2 | |
salt/ext/tornado/test/import_test.py | yuriks/salt | 1 | 8313 | # flake8: noqa
# pylint: skip-file
from __future__ import absolute_import, division, print_function
from salt.ext.tornado.test.util import unittest
class ImportTest(unittest.TestCase):
def test_import_everything(self):
# Some of our modules are not otherwise tested. Import them
# all (unless they... | # flake8: noqa
# pylint: skip-file
from __future__ import absolute_import, division, print_function
from salt.ext.tornado.test.util import unittest
class ImportTest(unittest.TestCase):
def test_import_everything(self):
# Some of our modules are not otherwise tested. Import them
# all (unless they... | en | 0.858266 | # flake8: noqa # pylint: skip-file # Some of our modules are not otherwise tested. Import them # all (unless they have external dependencies) here to at # least ensure that there are no syntax errors. # for modules with dependencies, if those dependencies can be loaded, # load them too. # type: ignore | 2.1261 | 2 |
butterfree/configs/db/metastore_config.py | fossabot/butterfree | 0 | 8314 | """Holds configurations to read and write with Spark to AWS S3."""
import os
from typing import Any, Dict, List, Optional
from pyspark.sql import DataFrame
from butterfree.configs import environment
from butterfree.configs.db import AbstractWriteConfig
from butterfree.dataframe_service import extract_partition_value... | """Holds configurations to read and write with Spark to AWS S3."""
import os
from typing import Any, Dict, List, Optional
from pyspark.sql import DataFrame
from butterfree.configs import environment
from butterfree.configs.db import AbstractWriteConfig
from butterfree.dataframe_service import extract_partition_value... | en | 0.683056 | Holds configurations to read and write with Spark to AWS S3. Configuration for Spark metastore database stored. By default the configuration is for AWS S3. Attributes: path: database root location. mode: writing mode used be writers. format_: expected stored file format. file_s... | 2.69569 | 3 |
examples/2-objects.py | johanngan/special_relativity | 4 | 8315 | #!/usr/bin/env python3
import sys
sys.path.append('..')
import specrel.geom as geom
import specrel.spacetime.physical as phy
import specrel.visualize as vis
# Shared parameters
include_grid = True
include_legend = True
tlim = (0, 2)
xlim = (-2, 2)
# A stationary point object
stationary = phy.MovingObject(0, draw_opt... | #!/usr/bin/env python3
import sys
sys.path.append('..')
import specrel.geom as geom
import specrel.spacetime.physical as phy
import specrel.visualize as vis
# Shared parameters
include_grid = True
include_legend = True
tlim = (0, 2)
xlim = (-2, 2)
# A stationary point object
stationary = phy.MovingObject(0, draw_opt... | en | 0.673224 | #!/usr/bin/env python3 # Shared parameters # A stationary point object ## Alternate: # direction = (1, 0) # point = (0, 0) # stationary = geom.Line(direction, point, draw_options={'label': '$v = 0$'}) # A stationary point object, animated # A stationary point object, animated with worldline # A bunch of moving point ob... | 2.207962 | 2 |
firmware/modulator.py | mfkiwl/OpenXcvr | 14 | 8316 | from baremetal import *
from math import pi, sin, cos
import sys
from scale import scale
from settings import *
from ssb import ssb_polar
def modulator(clk, audio, audio_stb, settings):
audio_bits = audio.subtype.bits
#AM modulation
am_mag = Unsigned(12).constant(0) + audio + 2048
am_phase = Signe... | from baremetal import *
from math import pi, sin, cos
import sys
from scale import scale
from settings import *
from ssb import ssb_polar
def modulator(clk, audio, audio_stb, settings):
audio_bits = audio.subtype.bits
#AM modulation
am_mag = Unsigned(12).constant(0) + audio + 2048
am_phase = Signe... | en | 0.241182 | #AM modulation #FM modulation #ssb #cw modulation #mode switching #simulate #mode am stim am #test_modulator(stimulus, FM) #test_modulator(stimulus, FM) #test_modulator(stimulus, NBFM) | 2.235083 | 2 |
tests/sentry/auth/test_helper.py | pierredup/sentry | 0 | 8317 | from __future__ import absolute_import
from six.moves.urllib.parse import urlencode
from django.test import RequestFactory
from django.contrib.auth.models import AnonymousUser
from sentry.auth.helper import handle_new_user
from sentry.models import AuthProvider, InviteStatus, OrganizationMember
from sentry.testutils ... | from __future__ import absolute_import
from six.moves.urllib.parse import urlencode
from django.test import RequestFactory
from django.contrib.auth.models import AnonymousUser
from sentry.auth.helper import handle_new_user
from sentry.models import AuthProvider, InviteStatus, OrganizationMember
from sentry.testutils ... | en | 0.962702 | # The org member invite should have a non matching email, but the # member id and token will match from the cookie, allowing association | 2.003538 | 2 |
groundstation/broadcast_events/__init__.py | richo/groundstation | 26 | 8318 | <reponame>richo/groundstation
from broadcast_ping import BroadcastPing
EVENT_TYPES = {
"PING": BroadcastPing,
}
class UnknownBroadcastEvent(Exception):
pass
def new_broadcast_event(data):
event_type, payload = data.split(" ", 1)
if event_type not in EVENT_TYPES:
raise UnknownBroadcastEven... | from broadcast_ping import BroadcastPing
EVENT_TYPES = {
"PING": BroadcastPing,
}
class UnknownBroadcastEvent(Exception):
pass
def new_broadcast_event(data):
event_type, payload = data.split(" ", 1)
if event_type not in EVENT_TYPES:
raise UnknownBroadcastEvent(event_type)
return EVENT... | none | 1 | 2.740414 | 3 | |
mbta_python/__init__.py | dougzor/mbta_python | 0 | 8319 | import datetime
import requests
from mbta_python.models import Stop, Direction, Schedule, Mode, \
TripSchedule, Alert, StopWithMode, Prediction
HOST = "http://realtime.mbta.com/developer/api/v2"
def datetime_to_epoch(dt):
epoch = datetime.datetime.utcfromtimestamp(0)
return int((dt - epoch).total_second... | import datetime
import requests
from mbta_python.models import Stop, Direction, Schedule, Mode, \
TripSchedule, Alert, StopWithMode, Prediction
HOST = "http://realtime.mbta.com/developer/api/v2"
def datetime_to_epoch(dt):
epoch = datetime.datetime.utcfromtimestamp(0)
return int((dt - epoch).total_second... | en | 0.880313 | Wrapper around calls to the MBTA Realtime API Get a List of Stops sorted by proximity to the given latitude and longitude Return a List of Directions for the route_id that contain a list of Stops that Direction and Route serve Return a list of routes that serve a particular stop Return scheduled arrival... | 2.84457 | 3 |
density_model_torch_custom.py | piotrwinkler/breast_density_classifier | 0 | 8320 | <reponame>piotrwinkler/breast_density_classifier<gh_stars>0
import argparse
import glob
import os
import numpy as np
import torch
from sklearn.metrics import accuracy_score
import models_torch as models
import utils
EXPERIMENT_DATA_DIR = "/tmp/mgr"
def inference(parameters, verbose=True) -> int:
# resolve de... | import argparse
import glob
import os
import numpy as np
import torch
from sklearn.metrics import accuracy_score
import models_torch as models
import utils
EXPERIMENT_DATA_DIR = "/tmp/mgr"
def inference(parameters, verbose=True) -> int:
# resolve device
device = torch.device(
"cuda:{}".format(par... | en | 0.419594 | # resolve device # load input images # construct models and prepare data # run prediction # nicely prints out the predictions # return density in scope 1 to 4 # parser.add_argument('--image-path', default="images/") # "image_path": args.image_path, python density_model_torch_custom.py histogram python density_model_tor... | 2.169504 | 2 |
esmvaltool/diag_scripts/ensclus/ens_anom.py | yifatdzigan/ESMValTool | 148 | 8321 | """Computation of ensemble anomalies based on a desired value."""
import os
import numpy as np
from scipy import stats
# User-defined packages
from read_netcdf import read_iris, save_n_2d_fields
from sel_season_area import sel_area, sel_season
def ens_anom(filenames, dir_output, name_outputs, varname, numens, seaso... | """Computation of ensemble anomalies based on a desired value."""
import os
import numpy as np
from scipy import stats
# User-defined packages
from read_netcdf import read_iris, save_n_2d_fields
from sel_season_area import sel_area, sel_season
def ens_anom(filenames, dir_output, name_outputs, varname, numens, seaso... | en | 0.845845 | Computation of ensemble anomalies based on a desired value. # User-defined packages Ensemble anomalies. Computation of the ensemble anomalies based on the desired value from the input variable (it can be the percentile, mean, maximum, standard deviation or trend) OUTPUT: NetCDF files of ensemble mean o... | 2.96774 | 3 |
pytition/petition/models.py | Te-k/Pytition | 0 | 8322 | <filename>pytition/petition/models.py
from django.db import models
from django.utils.html import mark_safe, strip_tags
from django.utils.text import slugify
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from django.core.exceptions import ValidationError
from djang... | <filename>pytition/petition/models.py
from django.db import models
from django.utils.html import mark_safe, strip_tags
from django.utils.text import slugify
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from django.core.exceptions import ValidationError
from djang... | en | 0.848554 | # let's search for slug collisions # Now confirm the signature corresponding to this hash # If there is no slug, ugly url # This petition is owned by an Organization # This petition is owned by a PytitionUser # This is a BUG! # invalidating other signatures from same email # just in case user is not specified #class M... | 2.057399 | 2 |
bin/socialhistory.py | JohnShullTopDev/generating-traning-data-for-healthcare-machine-learningcare- | 1 | 8323 | import csv
from testdata import SOCIALHISTORY_FILE
from testdata import rndDate
from patient import Patient
SMOKINGCODES = {
'428041000124106': 'Current some day smoker',
'266919005' : 'Never smoker',
'449868002' : 'Current every day smoker',
'266927001' : 'Unknown if ever smoked',
'... | import csv
from testdata import SOCIALHISTORY_FILE
from testdata import rndDate
from patient import Patient
SMOKINGCODES = {
'428041000124106': 'Current some day smoker',
'266919005' : 'Never smoker',
'449868002' : 'Current every day smoker',
'266927001' : 'Unknown if ever smoked',
'... | en | 0.694716 | Create instances of SocialHistory; also maintains socialHistory by patient id # Dictionary of socialHistory by patient ID Loads patient SocialHistory # Loop through socialHistories and build patient socialHistory lists: # Create a socialHistory instance # Append socialHistory to the patient's socialHistory list: | 3.061729 | 3 |
Python X/Dictionaries in python.py | nirobio/puzzles | 0 | 8324 | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# dictionaries, look-up tables & key-value pairs\n",
"# d = {} OR d = dict()\n",
"# e.g. d = {\"George\": 24, \"Tom\": 32}\n",
"\n",
"d = {}\n",
"\n"
]
},
{
"cell_typ... | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# dictionaries, look-up tables & key-value pairs\n",
"# d = {} OR d = dict()\n",
"# e.g. d = {\"George\": 24, \"Tom\": 32}\n",
"\n",
"d = {}\n",
"\n"
]
},
{
"cell_typ... | none | 1 | 1.947433 | 2 | |
lib/spack/spack/test/cache_fetch.py | LiamBindle/spack | 2,360 | 8325 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import pytest
from llnl.util.filesystem import mkdirp, touch
import spack.config
from spack.fetch_strategy im... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import pytest
from llnl.util.filesystem import mkdirp, touch
import spack.config
from spack.fetch_strategy im... | en | 0.71959 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) Ensure raise a missing cache file. Ensure a fetch after expanding is effectively a no-op. | 2.01561 | 2 |
temp_range_sql.py | hanhanwu/Hanhan-Spark-Python | 45 | 8326 | <reponame>hanhanwu/Hanhan-Spark-Python
__author__ = 'hanhanw'
import sys
from pyspark import SparkConf, SparkContext
from pyspark.sql.context import SQLContext
from pyspark.sql.types import StructType, StructField, StringType, DoubleType
conf = SparkConf().setAppName("temp range sql")
sc = SparkContext(conf=conf)
sq... | __author__ = 'hanhanw'
import sys
from pyspark import SparkConf, SparkContext
from pyspark.sql.context import SQLContext
from pyspark.sql.types import StructType, StructField, StringType, DoubleType
conf = SparkConf().setAppName("temp range sql")
sc = SparkContext(conf=conf)
sqlContext = SQLContext(sc)
assert sc.ver... | en | 0.595405 | SELECT r1.DateTime, r1.StationID, (r1.DataValue-r2.DataValue) AS Range FROM (SELECT StationID, DateTime, Observation, DataValue FROM Recordings WHERE Observation='TMAX') r1 JOIN (SELECT StationID, DateTime, Observation, DataValue FROM Recordings WHERE Observation='TMIN') r2 ON (r1.StationID... | 2.667005 | 3 |
container/pyf/graphqltypes/Event.py | Pompino/react-components-23KB | 2 | 8327 | from typing_extensions import Required
#from sqlalchemy.sql.sqltypes import Boolean
from graphene import ObjectType, String, Field, ID, List, DateTime, Mutation, Boolean, Int
from models.EventsRelated.EventModel import EventModel
from graphqltypes.Utils import extractSession
class EventType(ObjectType):
id = ID(... | from typing_extensions import Required
#from sqlalchemy.sql.sqltypes import Boolean
from graphene import ObjectType, String, Field, ID, List, DateTime, Mutation, Boolean, Int
from models.EventsRelated.EventModel import EventModel
from graphqltypes.Utils import extractSession
class EventType(ObjectType):
id = ID(... | en | 0.150175 | #from sqlalchemy.sql.sqltypes import Boolean | 2.173708 | 2 |
desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/drawing/shape.py | kokosing/hue | 3 | 8328 | <filename>desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/drawing/shape.py
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from openpyxl.styles.colors import Color, BLACK, WHITE
from openpyxl.utils.units import (
pixels_to_EMU,
EMU_to_pixels,
short_color,
)
from openpyxl.compat i... | <filename>desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/drawing/shape.py
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from openpyxl.styles.colors import Color, BLACK, WHITE
from openpyxl.utils.units import (
pixels_to_EMU,
EMU_to_pixels,
short_color,
)
from openpyxl.compat i... | en | 0.60914 | # Copyright (c) 2010-2015 openpyxl a drawing inside a chart coordiantes are specified by the user in the axis units # other shapes to define : "line" "lineInv" "triangle" "rtTriangle" "diamond" "parallelogram" "trapezoid" "nonIsoscelesTrapezoid" "pentagon" "hexagon" "hept... | 2.299718 | 2 |
scripts/VCF/FILTER/subset_vcf.py | elowy01/igsr_analysis | 3 | 8329 |
from VcfQC import VcfQC
from ReseqTrackDB import File
from ReseqTrackDB import ReseqTrackDB
import argparse
import os
import logging
import datetime
#get command line arguments
parser = argparse.ArgumentParser(description='Script to subset a VCF by excluding the variants within the regions defined by a BED file')
... |
from VcfQC import VcfQC
from ReseqTrackDB import File
from ReseqTrackDB import ReseqTrackDB
import argparse
import os
import logging
import datetime
#get command line arguments
parser = argparse.ArgumentParser(description='Script to subset a VCF by excluding the variants within the regions defined by a BED file')
... | en | 0.394076 | #get command line arguments Reseqtrack DB connection parameters #constructing the out filename # create the logging file handler # add handler to logger object | 2.635062 | 3 |
controllers/restart.py | Acidburn0zzz/helloworld | 0 | 8330 | <reponame>Acidburn0zzz/helloworld
import os
from base import BaseHandler
class RestartHandler(BaseHandler):
def get(self):
if not self.authenticate(superuser=True):
return
os.system('touch ' + self.application.settings["restart_path"])
self.redirect(self.get_argument("next"))
| import os
from base import BaseHandler
class RestartHandler(BaseHandler):
def get(self):
if not self.authenticate(superuser=True):
return
os.system('touch ' + self.application.settings["restart_path"])
self.redirect(self.get_argument("next")) | none | 1 | 2.321021 | 2 | |
nova/tests/unit/conductor/tasks/test_migrate.py | badock/nova-tidb | 0 | 8331 | <gh_stars>0
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | en | 0.859654 | # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d... | 1.615812 | 2 |
CH7_GitCmdAndCtrl/modules/environment.py | maxmac12/BlackHatPython | 0 | 8332 | import os
def run(**kwargs):
print("[*] In environment module.")
return str(os.environ) | import os
def run(**kwargs):
print("[*] In environment module.")
return str(os.environ) | none | 1 | 1.895633 | 2 | |
diskcatalog/core/views.py | rywjhzd/Cataloging-and-Visualizing-Cradles-of-Planet-Formation | 0 | 8333 | from django.shortcuts import render
from .models import Disk
import os
def index(request):
context = {}
disk_list = Disk.objects.all()
context['disk_list'] = disk_list
return render(request, 'index.html', context)
#def index(request):
# module_dir = os.path.dirname(__file__)
# file_path = os.p... | from django.shortcuts import render
from .models import Disk
import os
def index(request):
context = {}
disk_list = Disk.objects.all()
context['disk_list'] = disk_list
return render(request, 'index.html', context)
#def index(request):
# module_dir = os.path.dirname(__file__)
# file_path = os.p... | en | 0.113488 | #def index(request): # module_dir = os.path.dirname(__file__) # file_path = os.path.join(module_dir, 'data.txt') # disk_list = open(file_path , 'r') # data = data_file.read() # context = {'disk_list': data} # return render(request, 'index.html', context) | 2.02282 | 2 |
misc/python/materialize/checks/insert_select.py | guswynn/materialize | 0 | 8334 | <reponame>guswynn/materialize<filename>misc/python/materialize/checks/insert_select.py
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specifi... | # Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software... | en | 0.660477 | # Copyright Materialize, Inc. and contributors. All rights reserved. # # Use of this software is governed by the Business Source License # included in the LICENSE file at the root of this repository. # # As of the Change Date specified in that file, in accordance with # the Business Source License, use of this software... | 2.126746 | 2 |
mojoco trivial/mujocoSim/UR5/simple_example/Mujoco_py_example.py | garlicbutter/Jonathan-Tom | 2 | 8335 | <filename>mojoco trivial/mujocoSim/UR5/simple_example/Mujoco_py_example.py
import numpy as np
import mujoco_py as mj
from mujoco_py_renderer import SimulationError, XMLError, MujocoPyRenderer
from mujoco_py import (MjSim, load_model_from_xml,functions,
load_model_from_path, MjSimState,
... | <filename>mojoco trivial/mujocoSim/UR5/simple_example/Mujoco_py_example.py
import numpy as np
import mujoco_py as mj
from mujoco_py_renderer import SimulationError, XMLError, MujocoPyRenderer
from mujoco_py import (MjSim, load_model_from_xml,functions,
load_model_from_path, MjSimState,
... | en | 0.245874 | <mujoco model="example"> <compiler coordinate="global"/> <default> <geom rgba=".8 .6 .4 1"/> </default> <asset> <texture type="skybox" builtin="gradient" rgb1="1 1 1" rgb2=".6 .8 1" width="256" height="256"/> </asset> <worldbody> <light pos="0 1 1" dir="... | 2.032383 | 2 |
evaluation/wordpress/pull_docker_images_from_private_registry.py | seveirbian/gear-old | 0 | 8336 | import sys
# package need to be installed, pip install docker
import docker
import time
import yaml
import os
import xlwt
auto = False
private_registry = "192.168.3.11:9999/"
# result
result = [["tag", "finishTime", "size", "data"], ]
class Puller:
def __init__(self, images):
self.images_to_pull = i... | import sys
# package need to be installed, pip install docker
import docker
import time
import yaml
import os
import xlwt
auto = False
private_registry = "192.168.3.11:9999/"
# result
result = [["tag", "finishTime", "size", "data"], ]
class Puller:
def __init__(self, images):
self.images_to_pull = i... | en | 0.807653 | # package need to be installed, pip install docker # result # detect whether the file exists, if true, delete it # if don't give a tag, then all image under this registry will be pulled # get present time # get present net data # pull images # print pull time # get image's size # record the image and its pulling time #... | 2.470561 | 2 |
jiminy/envs/vnc_wog.py | sibeshkar/jiminy | 3 | 8337 | <reponame>sibeshkar/jiminy<filename>jiminy/envs/vnc_wog.py
from jiminy.envs import vnc_env
from jiminy.spaces import VNCActionSpace
class WorldOfGooEnv(vnc_env.VNCEnv):
def __init__(self):
super(WorldOfGooEnv, self).__init__()
# TODO: set action space screen shape to match
# HACK: empty ke... | from jiminy.envs import vnc_env
from jiminy.spaces import VNCActionSpace
class WorldOfGooEnv(vnc_env.VNCEnv):
def __init__(self):
super(WorldOfGooEnv, self).__init__()
# TODO: set action space screen shape to match
# HACK: empty keys list fails for some weird reason, give it an 'a'
... | en | 0.743451 | # TODO: set action space screen shape to match # HACK: empty keys list fails for some weird reason, give it an 'a' | 2.276347 | 2 |
fedml_api/standalone/federated_sgan/fedssgan_api.py | arj119/FedML | 0 | 8338 | <filename>fedml_api/standalone/federated_sgan/fedssgan_api.py<gh_stars>0
import copy
import logging
import random
from typing import List, Tuple
import numpy as np
import torch
import wandb
from torch.utils.data import ConcatDataset
from fedml_api.standalone.fedavg.my_model_trainer import MyModelTrainer
from fedml_ap... | <filename>fedml_api/standalone/federated_sgan/fedssgan_api.py<gh_stars>0
import copy
import logging
import random
from typing import List, Tuple
import numpy as np
import torch
import wandb
from torch.utils.data import ConcatDataset
from fedml_api.standalone.fedavg.my_model_trainer import MyModelTrainer
from fedml_ap... | en | 0.572174 | Args: dataset: Dataset presplit into data loaders device: Device to run training on args: Additional args client_models: List of client models and their frequency participating (assuming a stateful algorithm for simplicity) ###########setup_clients (START)#############") ... | 2.082507 | 2 |
pytorch-word2vec-master/csv.py | arjun-sai-krishnan/tamil-morpho-embeddings | 2 | 8339 | <filename>pytorch-word2vec-master/csv.py<gh_stars>1-10
#!/usr/bin/env python3
import argparse
from collections import Counter
import pdb
import pickle
import re
import sys
import time
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch import optim
import torch.nn.func... | <filename>pytorch-word2vec-master/csv.py<gh_stars>1-10
#!/usr/bin/env python3
import argparse
from collections import Counter
import pdb
import pickle
import re
import sys
import time
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch import optim
import torch.nn.func... | en | 0.419023 | #!/usr/bin/env python3 # Build the vocabulary. word2sense = np.zeros((args.vocab_size, 5), dtype='int32') for i in range(args.vocab_size): word2sense[i, 0] = i ... | 2.453386 | 2 |
Ogrenciler/Varol/buyuksayi.py | ProEgitim/Python-Dersleri-BEM | 1 | 8340 | sayi1 = int(input("1. Sayı: "))
sayi2 = int(input("2. Sayı: "))
sayi3 = int(input("3. Sayı: "))
sayi4 = int(input("4. Sayı: "))
sayi5 = int(input("5. Sayı: "))
sayilar=[];
sayilar.append(sayi1)
sayilar.append(sayi2)
sayilar.append(sayi3)
sayilar.append(sayi4)
sayilar.append(sayi5)
sayilar.sort()
print("En büyük sayimiz... | sayi1 = int(input("1. Sayı: "))
sayi2 = int(input("2. Sayı: "))
sayi3 = int(input("3. Sayı: "))
sayi4 = int(input("4. Sayı: "))
sayi5 = int(input("5. Sayı: "))
sayilar=[];
sayilar.append(sayi1)
sayilar.append(sayi2)
sayilar.append(sayi3)
sayilar.append(sayi4)
sayilar.append(sayi5)
sayilar.sort()
print("En büyük sayimiz... | none | 1 | 3.649919 | 4 | |
baselines/deepq/build_graph_mfec.py | MouseHu/emdqn | 0 | 8341 | <gh_stars>0
"""Deep Q learning graph
The functions in this file can are used to create the following functions:
======= act ========
Function to chose an action given an observation
Parameters
----------
observation: object
Observation that can be feed into the output of make_obs_ph
stoc... | """Deep Q learning graph
The functions in this file can are used to create the following functions:
======= act ========
Function to chose an action given an observation
Parameters
----------
observation: object
Observation that can be feed into the output of make_obs_ph
stochastic: bool... | en | 0.760463 | Deep Q learning graph The functions in this file can are used to create the following functions: ======= act ======== Function to chose an action given an observation Parameters ---------- observation: object Observation that can be feed into the output of make_obs_ph stochastic: bool ... | 3.10698 | 3 |
tests/test_prior.py | frodre/LMR | 17 | 8342 | <filename>tests/test_prior.py
import sys
sys.path.append('../')
import LMR_config as cfg
import LMR_prior
import numpy as np
import pytest
def test_prior_seed():
cfg_obj = cfg.Config(**{'core':{'seed': 2}})
prior_cfg = cfg_obj.prior
prior_source = '20cr'
datadir_prior = 'data'
datafile_prior = '... | <filename>tests/test_prior.py
import sys
sys.path.append('../')
import LMR_config as cfg
import LMR_prior
import numpy as np
import pytest
def test_prior_seed():
cfg_obj = cfg.Config(**{'core':{'seed': 2}})
prior_cfg = cfg_obj.prior
prior_source = '20cr'
datadir_prior = 'data'
datafile_prior = '... | en | 0.926232 | # Transform full prior into ensemble-like shape | 2.155715 | 2 |
src/salgan_dhf1k/train_bce.py | juanjo3ns/SalGAN2 | 0 | 8343 | <gh_stars>0
import os
from dataloader.datasetDHF1K import DHF1K
from torch.utils.data import DataLoader
from utils.salgan_utils import save_model, get_lr_optimizer
from utils.sendTelegram import send
from utils.printer import param_print
from utils.salgan_generator import create_model, add_bn
from evaluation.fast_eval... | import os
from dataloader.datasetDHF1K import DHF1K
from torch.utils.data import DataLoader
from utils.salgan_utils import save_model, get_lr_optimizer
from utils.sendTelegram import send
from utils.printer import param_print
from utils.salgan_generator import create_model, add_bn
from evaluation.fast_evaluation impor... | en | 0.505862 | # Mean of RGB weights of first layer with size [64,1,3,3] # We could do it easily accessing to the weights trought model[0].weight and change dimension 1, but as we # already have the 4th channel we'd be doing the mean of all of the channels, inicializing it in the wrong way. #iterate epoch... #iterate epoch... # noram... | 1.974925 | 2 |
dragontail/content/models/basicpage.py | tracon/dragontail | 0 | 8344 | <filename>dragontail/content/models/basicpage.py<gh_stars>0
# encoding: utf-8
from django.db import models
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import StreamField
from wagtail.wagtailcore import blocks
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel... | <filename>dragontail/content/models/basicpage.py<gh_stars>0
# encoding: utf-8
from django.db import models
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import StreamField
from wagtail.wagtailcore import blocks
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel... | en | 0.83829 | # encoding: utf-8 | 1.944486 | 2 |
infapy/v3/agentService.py | infapy/infapy | 0 | 8345 | # Copyright (c) 2021-Present (<NAME>)
# 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 writ... | # Copyright (c) 2021-Present (<NAME>)
# 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 writ... | en | 0.851108 | # Copyright (c) 2021-Present (<NAME>) # 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 writin... | 2.067729 | 2 |
home_application/views.py | pengwow/test-demo | 0 | 8346 | <reponame>pengwow/test-demo
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云(BlueKing) available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance w... | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云(BlueKing) available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obt... | en | 0.69726 | # -*- coding: utf-8 -*- Tencent is pleased to support the open source community by making 蓝鲸智云(BlueKing) available. Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain ... | 1.761333 | 2 |
Chapter 6/09 - The built-in multiprocessing module/basic_multiprocessing.py | moseskim/Expert-Python-Programming-Fourth-Edition | 0 | 8347 | <filename>Chapter 6/09 - The built-in multiprocessing module/basic_multiprocessing.py
"""
"멀티프로세싱"절 예시
`multiprocessing` 모듈을 이용해 새로운 프로세스들을
생성하는 방법을 설명한다.
"""
from multiprocessing import Process
import os
def work(identifier):
print(f'Hey, I am the process ' f'{identifier}, pid: {os.getpid()}')
def main():
... | <filename>Chapter 6/09 - The built-in multiprocessing module/basic_multiprocessing.py
"""
"멀티프로세싱"절 예시
`multiprocessing` 모듈을 이용해 새로운 프로세스들을
생성하는 방법을 설명한다.
"""
from multiprocessing import Process
import os
def work(identifier):
print(f'Hey, I am the process ' f'{identifier}, pid: {os.getpid()}')
def main():
... | ko | 0.999824 | "멀티프로세싱"절 예시 `multiprocessing` 모듈을 이용해 새로운 프로세스들을 생성하는 방법을 설명한다. | 3.794383 | 4 |
sweeper/cloud/localhost/manager.py | dominoFire/sweeper | 0 | 8348 | <reponame>dominoFire/sweeper
__author__ = '@dominofire'
import os
from sweeper.cloud import resource_config_combinations
from sweeper.cloud.localhost import resource_config_factory as config_factory
from sweeper.resource import Resource
def possible_configs(num):
configs = config_factory.list_configs()
comb... | __author__ = '@dominofire'
import os
from sweeper.cloud import resource_config_combinations
from sweeper.cloud.localhost import resource_config_factory as config_factory
from sweeper.resource import Resource
def possible_configs(num):
configs = config_factory.list_configs()
combs = resource_config_combinati... | none | 1 | 2.060013 | 2 | |
tfx/orchestration/experimental/core/service_jobs_test.py | BACtaki/tfx | 1,813 | 8349 | # Copyright 2021 Google LLC. 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 a... | # Copyright 2021 Google LLC. 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 a... | en | 0.842701 | # Copyright 2021 Google LLC. 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 a... | 1.897286 | 2 |
dragonn/models.py | kundajelab/dragonn | 251 | 8350 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function
import matplotlib
import numpy as np
import os
import subprocess
import sys
import tempfile
matplotlib.use('pdf')
import matplotlib.pyplot as plt
from abc import abstractmethod, ABCMeta
from dragonn.metrics import ClassificationResult
f... | from __future__ import absolute_import, division, print_function
import matplotlib
import numpy as np
import os
import subprocess
import sys
import tempfile
matplotlib.use('pdf')
import matplotlib.pyplot as plt
from abc import abstractmethod, ABCMeta
from dragonn.metrics import ClassificationResult
from sklearn.svm imp... | en | 0.628045 | Sequence DNN models. Parameters ---------- seq_length : int, optional length of input sequence. keras_model : instance of keras.models.Sequential, optional seq_length or keras_model must be specified. num_tasks : int, optional number of tasks. Default: 1. num_filters : l... | 2.406397 | 2 |
src/mpass/mpass/migrations/0001_initial.py | haltu/velmu-mpass-demo | 0 | 8351 | <reponame>haltu/velmu-mpass-demo<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-20 08:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import parler.models
class Migration(migrations.Migration):
initial = True
... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-20 08:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import parler.models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | en | 0.636876 | # -*- coding: utf-8 -*- # Generated by Django 1.11.10 on 2018-03-20 08:34 | 1.648677 | 2 |
dgt/inference/forward_inference.py | fractalego/dgt | 3 | 8352 | <filename>dgt/inference/forward_inference.py
import logging
import random
from dgt.graph.graph_matcher import GraphWeightedMatch
from dgt.utils import graph_iterations
_logger = logging.getLogger(__name__)
def find_weight_between(s, first, last):
try:
start = s.index(first) + len(first)
end = s.... | <filename>dgt/inference/forward_inference.py
import logging
import random
from dgt.graph.graph_matcher import GraphWeightedMatch
from dgt.utils import graph_iterations
_logger = logging.getLogger(__name__)
def find_weight_between(s, first, last):
try:
start = s.index(first) + len(first)
end = s.... | en | 0.851442 | Applies all the rules to a drs :return: all the variants of the drs after a rule match as a pair (<NEW_DRS>, <WEIGHT>) # A rule can be used only once per path | 2.255202 | 2 |
serverPythonClient/client.py | ikekilinc/dnnSuperBinoculars | 0 | 8353 | <filename>serverPythonClient/client.py
import argparse
import cv2
import common
# from .utils.cropAtCenter import cropImageCenter
# from cropAtCenter import cropImageCenter
from gabriel_client.websocket_client import WebsocketClient
from gabriel_client.opencv_adapter import OpencvAdapter
DEFAULT_SERVER_HOST = '172.1... | <filename>serverPythonClient/client.py
import argparse
import cv2
import common
# from .utils.cropAtCenter import cropImageCenter
# from cropAtCenter import cropImageCenter
from gabriel_client.websocket_client import WebsocketClient
from gabriel_client.opencv_adapter import OpencvAdapter
DEFAULT_SERVER_HOST = '172.1... | en | 0.361131 | # from .utils.cropAtCenter import cropImageCenter # from cropAtCenter import cropImageCenter # return frame | 2.635863 | 3 |
src/DeepCard.API/batch.py | SharsDela/BankCardRecognize | 7 | 8354 | from api import get_result
import os
import shutil
from glob import glob
from PIL import Image
if __name__ == '__main__':
image_files = glob('./test_images/*.*')
result_dir = './test_results'
if os.path.exists(result_dir):
shutil.rmtree(result_dir)
os.mkdir(result_dir)
txt_file = os.path.j... | from api import get_result
import os
import shutil
from glob import glob
from PIL import Image
if __name__ == '__main__':
image_files = glob('./test_images/*.*')
result_dir = './test_results'
if os.path.exists(result_dir):
shutil.rmtree(result_dir)
os.mkdir(result_dir)
txt_file = os.path.j... | none | 1 | 2.666684 | 3 | |
CIM14/ENTSOE/Equipment/Core/Curve.py | MaximeBaudette/PyCIM | 58 | 8355 | # Copyright (C) 2010-2011 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distrib... | # Copyright (C) 2010-2011 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distrib... | en | 0.534452 | # Copyright (C) 2010-2011 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distrib... | 1.839324 | 2 |
fluent/syntax/errors.py | unclenachoduh/python-fluent | 0 | 8356 | from __future__ import unicode_literals
class ParseError(Exception):
def __init__(self, code, *args):
self.code = code
self.args = args
self.message = get_error_message(code, args)
def get_error_message(code, args):
if code == 'E00001':
return 'Generic error'
if code == '... | from __future__ import unicode_literals
class ParseError(Exception):
def __init__(self, code, *args):
self.code = code
self.args = args
self.message = get_error_message(code, args)
def get_error_message(code, args):
if code == 'E00001':
return 'Generic error'
if code == '... | none | 1 | 2.960001 | 3 | |
tests/test_mag.py | jdddog/mag-archiver | 0 | 8357 | # Copyright 2020 Curtin University
#
# 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 writi... | # Copyright 2020 Curtin University
#
# 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 writi... | en | 0.833932 | # Copyright 2020 Curtin University # # 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 writi... | 2.071854 | 2 |
twitterinfrastructure/CH-Data-Public.py | jacob-heglund/socialsensing-jh | 0 | 8358 | '''
Created on Mar 22, 2018
Edited on Jan 11, 2019
@author: npvance2
@author: curtisd2
Variables that will need to be edited/personalized:
monitorID in Variables() (line 27)
projectStartDate in Variables() (line 28)
projectEndDate in Variables() (line 29)
authToken in getAuthToken() (... | '''
Created on Mar 22, 2018
Edited on Jan 11, 2019
@author: npvance2
@author: curtisd2
Variables that will need to be edited/personalized:
monitorID in Variables() (line 27)
projectStartDate in Variables() (line 28)
projectEndDate in Variables() (line 29)
authToken in getAuthToken() (... | en | 0.659623 | Created on Mar 22, 2018 Edited on Jan 11, 2019 @author: npvance2 @author: curtisd2 Variables that will need to be edited/personalized: monitorID in Variables() (line 27) projectStartDate in Variables() (line 28) projectEndDate in Variables() (line 29) authToken in getAuthToken() (line... | 2.607501 | 3 |
roles/slurm/files/startnode.py | danhnguyen48/slurm-elastic-computing | 0 | 8359 | #! /opt/cloud_sdk/bin/python
import asyncio
import logging
import subprocess
import sys
import citc_cloud
def handle_exception(exc_type, exc_value, exc_traceback):
if issubclass(exc_type, KeyboardInterrupt):
sys.__excepthook__(exc_type, exc_value, exc_traceback)
return
log.critical("Uncaugh... | #! /opt/cloud_sdk/bin/python
import asyncio
import logging
import subprocess
import sys
import citc_cloud
def handle_exception(exc_type, exc_value, exc_traceback):
if issubclass(exc_type, KeyboardInterrupt):
sys.__excepthook__(exc_type, exc_value, exc_traceback)
return
log.critical("Uncaugh... | en | 0.235294 | #! /opt/cloud_sdk/bin/python | 1.878928 | 2 |
tests/pyre/components/component_class_registration_model.py | BryanRiel/pyre | 0 | 8360 | <filename>tests/pyre/components/component_class_registration_model.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# <NAME>
# orthologue
# (c) 1998-2018 all rights reserved
#
"""
Verify that component registration interacts correctly with the pyre configurator model
"""
# access
# print(" -- importing... | <filename>tests/pyre/components/component_class_registration_model.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# <NAME>
# orthologue
# (c) 1998-2018 all rights reserved
#
"""
Verify that component registration interacts correctly with the pyre configurator model
"""
# access
# print(" -- importing... | en | 0.704659 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # <NAME> # orthologue # (c) 1998-2018 all rights reserved # Verify that component registration interacts correctly with the pyre configurator model # access # print(" -- importing pyre") # print(" -- done") # declare a protocol a protocol # properties # behavior behave #... | 2.340419 | 2 |
tests/unit/transport/plugins/asyncssh/test_asyncssh_transport.py | carlmontanari/nssh | 1 | 8361 | import asyncio
from io import BytesIO
import pytest
from asyncssh.connection import SSHClientConnection
from asyncssh.stream import SSHReader
from scrapli.exceptions import ScrapliConnectionNotOpened, ScrapliTimeout
class DumbContainer:
def __init__(self):
self.preferred_auth = ()
def __getattr__(s... | import asyncio
from io import BytesIO
import pytest
from asyncssh.connection import SSHClientConnection
from asyncssh.stream import SSHReader
from scrapli.exceptions import ScrapliConnectionNotOpened, ScrapliTimeout
class DumbContainer:
def __init__(self):
self.preferred_auth = ()
def __getattr__(s... | en | 0.940067 | # options has a billion attributes, just return None, doesnt matter for this test # lie and pretend the session is already assigned # lie and pretend the session is already assigned # lie and pretend the session is already assigned # lie and tell asyncssh auth is done # also have to lie and create a transport and have ... | 1.981328 | 2 |
apps/ignite/views.py | Mozilla-GitHub-Standards/93f18f14efcf5fdfc0e04f9bf247f66baf46663f37b1d2087ab8d850abc90803 | 2 | 8362 | <filename>apps/ignite/views.py
from django.shortcuts import get_object_or_404
import jingo
import waffle
from django.contrib.auth.models import User
from challenges.models import Submission, Category
from projects.models import Project
from blogs.models import BlogEntry
from events.models import Event
def splash(req... | <filename>apps/ignite/views.py
from django.shortcuts import get_object_or_404
import jingo
import waffle
from django.contrib.auth.models import User
from challenges.models import Submission, Category
from projects.models import Project
from blogs.models import BlogEntry
from events.models import Event
def splash(req... | en | 0.910673 | Show an individual project challenge. # have we announced the winners yet - switch template # if the dev challenge is open we want to only show dev entries List all judges we have in the system # we only want to show featured profiles Generic page for unavailable actions | 1.904672 | 2 |
dataPresenter.py | thebouv/IUS-Hacktoberfest | 3 | 8363 | from plotly.subplots import make_subplots
import plotly.graph_objects as go
import plotly.io as pio
from dataProcessor import parseLabels, parseLangs
import plotly.io as pio
import os
years = parseLabels()
langs = parseLangs()
#make the plotly results
fig = make_subplots(
rows=1, cols=2,
specs=[[{"type": "x... | from plotly.subplots import make_subplots
import plotly.graph_objects as go
import plotly.io as pio
from dataProcessor import parseLabels, parseLangs
import plotly.io as pio
import os
years = parseLabels()
langs = parseLangs()
#make the plotly results
fig = make_subplots(
rows=1, cols=2,
specs=[[{"type": "x... | en | 0.915831 | #make the plotly results | 2.750517 | 3 |
bdlb/diabetic_retinopathy_diagnosis/benchmark.py | Sairam954/bdl-benchmarks | 666 | 8364 | # Copyright 2019 BDL Benchmarks 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 applica... | # Copyright 2019 BDL Benchmarks 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 applica... | en | 0.651296 | # Copyright 2019 BDL Benchmarks 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 applica... | 1.848437 | 2 |
db/redis_db.py | Lifeistrange/WeiboSpider | 1 | 8365 | <reponame>Lifeistrange/WeiboSpider
# coding:utf-8
import datetime
import json
import re
import redis
from config.conf import get_redis_args
redis_args = get_redis_args()
class Cookies(object):
rd_con = redis.StrictRedis(host=redis_args.get('host'), port=redis_args.get('port'),
pas... | # coding:utf-8
import datetime
import json
import re
import redis
from config.conf import get_redis_args
redis_args = get_redis_args()
class Cookies(object):
rd_con = redis.StrictRedis(host=redis_args.get('host'), port=redis_args.get('port'),
password=redis_args.get('password'), d... | zh | 0.9377 | # coding:utf-8 # 当账号不存在时,这个name也会清除,并取下一个name # 丢弃这个过期账号,account_queue会在下次访问的时候被清除,这里不清除是因为分布式的关系 | 2.378766 | 2 |
vivisect/storage/mpfile.py | vEpiphyte/vivisect | 0 | 8366 | import base64
import logging
import msgpack
logger = logging.getLogger(__name__)
loadargs = {'use_list': False, 'raw': False}
if msgpack.version < (1, 0, 0):
loadargs['encoding'] = 'utf-8'
else:
loadargs['strict_map_key'] = False
VSIG = b'MSGVIV'.ljust(8, b'\x00')
def vivEventsAppendFile(filename, events)... | import base64
import logging
import msgpack
logger = logging.getLogger(__name__)
loadargs = {'use_list': False, 'raw': False}
if msgpack.version < (1, 0, 0):
loadargs['encoding'] = 'utf-8'
else:
loadargs['strict_map_key'] = False
VSIG = b'MSGVIV'.ljust(8, b'\x00')
def vivEventsAppendFile(filename, events)... | none | 1 | 2.140899 | 2 | |
pytest_pgsql/plugin.py | mathiasose/pytest-pgsql | 0 | 8367 | <filename>pytest_pgsql/plugin.py
"""This forms the core of the pytest plugin."""
import pytest
import testing.postgresql
from pytest_pgsql import database
from pytest_pgsql import ext
def pytest_addoption(parser):
"""Add configuration options for pytest_pgsql."""
parser.addoption(
'--pg-extensions',... | <filename>pytest_pgsql/plugin.py
"""This forms the core of the pytest plugin."""
import pytest
import testing.postgresql
from pytest_pgsql import database
from pytest_pgsql import ext
def pytest_addoption(parser):
"""Add configuration options for pytest_pgsql."""
parser.addoption(
'--pg-extensions',... | en | 0.777745 | This forms the core of the pytest plugin. Add configuration options for pytest_pgsql. A fixture giving the connection URI of the session-wide test database. # Note: due to the nature of the variable configs, the command line options # must be tested manually. # pragma: no cover # pragma: no cover # Disable memory tweak... | 2.270895 | 2 |
power_data_to_sat_passes/date_utils.py | abrahamneben/orbcomm_beam_mapping | 1 | 8368 | # written by abraham on aug 24
def dyear2date(dyear):
year = int(dyear)
month_lengths = [31,28,31,30,31,30,31,31,30,31,30,31]
days_before_months = [0,31,59,90,120,151,181,212,243,273,304,334]
days_into_year_f = (dyear-year)*365
days_into_year_i = int(days_into_year_f)
for i in range(12):
if days_before_mo... | # written by abraham on aug 24
def dyear2date(dyear):
year = int(dyear)
month_lengths = [31,28,31,30,31,30,31,31,30,31,30,31]
days_before_months = [0,31,59,90,120,151,181,212,243,273,304,334]
days_into_year_f = (dyear-year)*365
days_into_year_i = int(days_into_year_f)
for i in range(12):
if days_before_mo... | en | 0.985122 | # written by abraham on aug 24 | 3.633322 | 4 |
app/base/count_lines.py | sourcery-ai-bot/personal-expenses-accounting | 5 | 8369 | import glob
from os import walk
exclude_folders = [
'node_modules',
'ios',
'android',
'__pycache__'
]
exclude_files = [
'json',
'txt',
'traineddata',
'lstmf',
'yml',
'md'
'log',
'env',
'gitignore',
'dockerignore'
]
# get all files in directory
dirr = '/home/vik... | import glob
from os import walk
exclude_folders = [
'node_modules',
'ios',
'android',
'__pycache__'
]
exclude_files = [
'json',
'txt',
'traineddata',
'lstmf',
'yml',
'md'
'log',
'env',
'gitignore',
'dockerignore'
]
# get all files in directory
dirr = '/home/vik... | en | 0.809791 | # get all files in directory # only app related directories # num_lines = sum(1 for line in open('myfile.txt')) | 3.018135 | 3 |
data/contacts.py | rgurevych/python_for_testers | 0 | 8370 |
from models.contact import Contact
testdata = [Contact(first_name="Firstname", last_name="Lastname", mobile_phone="+12345678",
work_phone="12345", home_phone="67890", fax="55443322", email_1="<EMAIL>",
email_2="<EMAIL>", email_3="<EMAIL>",
... |
from models.contact import Contact
testdata = [Contact(first_name="Firstname", last_name="Lastname", mobile_phone="+12345678",
work_phone="12345", home_phone="67890", fax="55443322", email_1="<EMAIL>",
email_2="<EMAIL>", email_3="<EMAIL>",
... | none | 1 | 2.021627 | 2 | |
charmhelpers/contrib/charmsupport/nrpe.py | nobuto-m/charm-helpers | 0 | 8371 | <filename>charmhelpers/contrib/charmsupport/nrpe.py<gh_stars>0
# Copyright 2014-2015 Canonical Limited.
#
# 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/LIC... | <filename>charmhelpers/contrib/charmsupport/nrpe.py<gh_stars>0
# Copyright 2014-2015 Canonical Limited.
#
# 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/LIC... | en | 0.69985 | # Copyright 2014-2015 Canonical Limited. # # 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 ... | 1.68381 | 2 |
venv/Lib/site-packages/proglog/proglog.py | mintzer/pupillometry-rf-back | 83 | 8372 | """Implements the generic progress logger class, and the ProgressBar class.
"""
from tqdm import tqdm, tqdm_notebook
from collections import OrderedDict
import time
SETTINGS = {
'notebook': False
}
def notebook(turn='on'):
SETTINGS['notebook'] = True if (turn == 'on') else False
def troncate_string(s, max_l... | """Implements the generic progress logger class, and the ProgressBar class.
"""
from tqdm import tqdm, tqdm_notebook
from collections import OrderedDict
import time
SETTINGS = {
'notebook': False
}
def notebook(turn='on'):
SETTINGS['notebook'] = True if (turn == 'on') else False
def troncate_string(s, max_l... | en | 0.757778 | Implements the generic progress logger class, and the ProgressBar class. Generic class for progress loggers. A progress logger contains a "state" dictionnary. Parameters ---------- init_state Dictionnary representing the initial state. Execute something after the state has been updated by the g... | 3.17138 | 3 |
gdsfactory/tests/test_component_from_yaml_bezier.py | jorgepadilla19/gdsfactory | 42 | 8373 | <reponame>jorgepadilla19/gdsfactory
import gdsfactory as gf
from gdsfactory.component import Component
yaml = """
name:
test_component_yaml_without_cell
instances:
mmi:
component: mmi1x2
bend:
component: bend_s
connections:
bend,o1: mmi,o2
"""
def test_component_from_yaml_without_cell(... | import gdsfactory as gf
from gdsfactory.component import Component
yaml = """
name:
test_component_yaml_without_cell
instances:
mmi:
component: mmi1x2
bend:
component: bend_s
connections:
bend,o1: mmi,o2
"""
def test_component_from_yaml_without_cell() -> Component:
"""bezier does n... | en | 0.640118 | name: test_component_yaml_without_cell instances: mmi: component: mmi1x2 bend: component: bend_s connections: bend,o1: mmi,o2 bezier does not have cell | 2.438397 | 2 |
cats/types.py | AdamBrianBright/cats-python | 2 | 8374 | <filename>cats/types.py
from pathlib import Path
from types import GeneratorType
from typing import AsyncIterable, Iterable, TypeAlias
import ujson
from cats.errors import MalformedHeadersError
try:
from django.db.models import QuerySet, Model
except ImportError:
QuerySet = type('QuerySet', (list,), {})
... | <filename>cats/types.py
from pathlib import Path
from types import GeneratorType
from typing import AsyncIterable, Iterable, TypeAlias
import ujson
from cats.errors import MalformedHeadersError
try:
from django.db.models import QuerySet, Model
except ImportError:
QuerySet = type('QuerySet', (list,), {})
... | en | 0.776727 | Custom Missing type is required for Pydantic to work properly. IDK # + UnicodeDecodeError | 2.392644 | 2 |
raven/utils/urlparse.py | MyCollege/raven | 0 | 8375 | <gh_stars>0
from __future__ import absolute_import
try:
import urlparse as _urlparse
except ImportError:
from urllib import parse as _urlparse
def register_scheme(scheme):
for method in filter(lambda s: s.startswith('uses_'), dir(_urlparse)):
uses = getattr(_urlparse, method)
if scheme n... | from __future__ import absolute_import
try:
import urlparse as _urlparse
except ImportError:
from urllib import parse as _urlparse
def register_scheme(scheme):
for method in filter(lambda s: s.startswith('uses_'), dir(_urlparse)):
uses = getattr(_urlparse, method)
if scheme not in uses:
... | none | 1 | 2.277474 | 2 | |
setup.py | stjordanis/MONeT-1 | 161 | 8376 | <filename>setup.py
import setuptools
setuptools.setup(
name="monet_memory_optimized_training",
version="0.0.1",
description="Memory Optimized Network Training Framework",
url="https://github.com/philkr/lowrank_conv",
packages=setuptools.find_packages(include = ['monet', 'monet.*', 'models', 'checkm... | <filename>setup.py
import setuptools
setuptools.setup(
name="monet_memory_optimized_training",
version="0.0.1",
description="Memory Optimized Network Training Framework",
url="https://github.com/philkr/lowrank_conv",
packages=setuptools.find_packages(include = ['monet', 'monet.*', 'models', 'checkm... | none | 1 | 1.227586 | 1 | |
Tests/Methods/Machine/test_Magnet_Type_11_meth.py | Superomeg4/pyleecan | 2 | 8377 | # -*- coding: utf-8 -*-
"""
@date Created on Thu Dec 18 13:56:33 2014
@copyright (C) 2014-2015 EOMYS ENGINEERING.
@author pierre_b
"""
from unittest import TestCase
from ddt import ddt, data
from pyleecan.Classes.Arc1 import Arc1
from pyleecan.Classes.Segment import Segment
from pyleecan.Classes.MagnetType11 import... | # -*- coding: utf-8 -*-
"""
@date Created on Thu Dec 18 13:56:33 2014
@copyright (C) 2014-2015 EOMYS ENGINEERING.
@author pierre_b
"""
from unittest import TestCase
from ddt import ddt, data
from pyleecan.Classes.Arc1 import Arc1
from pyleecan.Classes.Segment import Segment
from pyleecan.Classes.MagnetType11 import... | en | 0.817221 | # -*- coding: utf-8 -*- @date Created on Thu Dec 18 13:56:33 2014 @copyright (C) 2014-2015 EOMYS ENGINEERING. @author pierre_b # Internal Slot surface # Internal Slot inset # Outward Slot inset # For AlmostEqual unittest for MagnetType11 methods Check that the computation of the surface is correct # Compare numerical a... | 2.012276 | 2 |
tomo_encoders/tasks/void_mapping.py | arshadzahangirchowdhury/TomoEncoders | 0 | 8378 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
from operator import mod
from tomo_encoders.misc.voxel_processing import modified_autocontrast, TimerGPU
from tomo_encoders.reconstruction.recon import recon_patches_3d
import cupy as cp
import numpy as np
from skimage.filters import threshold_otsu
from tomo_en... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
from operator import mod
from tomo_encoders.misc.voxel_processing import modified_autocontrast, TimerGPU
from tomo_encoders.reconstruction.recon import recon_patches_3d
import cupy as cp
import numpy as np
from skimage.filters import threshold_otsu
from tomo_en... | en | 0.515202 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- # inside is positive # inside is positive segment volume with otsu # rec_min_max = modified_autocontrast(tmp_values, s = s, normalize_sampling_factor=1) this algorithm was inspired by: https://github.com/tomochallenge/tomochallenge_utils/blob/master/foam_phantom_utils.py #... | 2.089592 | 2 |
handypackages/subscribe/migrations/0001_initial.py | roundium/handypackages | 1 | 8379 | # Generated by Django 2.2.1 on 2019-06-22 11:03
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SubscribeModel',
fields=[
('id', models.Aut... | # Generated by Django 2.2.1 on 2019-06-22 11:03
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SubscribeModel',
fields=[
('id', models.Aut... | en | 0.746472 | # Generated by Django 2.2.1 on 2019-06-22 11:03 | 1.806068 | 2 |
TuShare/view/sh_margins.py | lwh2015/TuShare | 1 | 8380 | # -*- coding: UTF-8 -*-
import json
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import tushare as ts
from .publiceClass import DateEncoder
@csrf_exempt
def sh_margins(request):
try:
start = request.POST.get('start','')#选填
end = request.POST.get('end','... | # -*- coding: UTF-8 -*-
import json
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import tushare as ts
from .publiceClass import DateEncoder
@csrf_exempt
def sh_margins(request):
try:
start = request.POST.get('start','')#选填
end = request.POST.get('end','... | zh | 0.266282 | # -*- coding: UTF-8 -*- #选填 #选填 | 2.05571 | 2 |
intermediate/classes/camera.py | robertob45/learning-python | 0 | 8381 | class Camera:
"""docstring for ."""
def __init__(self, brand, sensor, lens, battery):
self.brand = brand
self.sensor = sensor
self.lens = lens
self.battery = battery
def __str__(self):
return self.brand + ' ' + self.sensor + ' ' + self.lens + ' ' + self.battery
... | class Camera:
"""docstring for ."""
def __init__(self, brand, sensor, lens, battery):
self.brand = brand
self.sensor = sensor
self.lens = lens
self.battery = battery
def __str__(self):
return self.brand + ' ' + self.sensor + ' ' + self.lens + ' ' + self.battery
... | en | 0.659294 | docstring for . | 3.751097 | 4 |
dbaas/tsuru/tests/test_service_add.py | didindinn/database-as-a-service | 0 | 8382 | <filename>dbaas/tsuru/tests/test_service_add.py
from mock import patch, MagicMock
from django.contrib.auth.models import User
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.utils.datastructures import MultiValueDictKeyError
from account.models import Role, Team, Organization... | <filename>dbaas/tsuru/tests/test_service_add.py
from mock import patch, MagicMock
from django.contrib.auth.models import User
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.utils.datastructures import MultiValueDictKeyError
from account.models import Role, Team, Organization... | en | 0.781346 | HTTP test cases for the tsuru Service Add. This class focuses on validations of POST | 2.301665 | 2 |
Main/migrations/0072_auto_20210506_0016.py | Muhammet-Yildiz/Ecommerce_Website-HepsiOrada | 10 | 8383 | # Generated by Django 3.1.4 on 2021-05-05 21:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Main', '0071_auto_20210506_0004'),
]
operations = [
migrations.RemoveField(
model_name='product',
name='chooseColor',
... | # Generated by Django 3.1.4 on 2021-05-05 21:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Main', '0071_auto_20210506_0004'),
]
operations = [
migrations.RemoveField(
model_name='product',
name='chooseColor',
... | en | 0.805638 | # Generated by Django 3.1.4 on 2021-05-05 21:16 | 1.531207 | 2 |
1.py | zweed4u/dailycodingproblem | 0 | 8384 | #!/usr/bin/python3
"""
Good morning! Here's your coding interview problem for today.
This problem was recently asked by Google.
Given a list of numbers and a number k, return whether any two numbers from the list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
Bonus: Can ... | #!/usr/bin/python3
"""
Good morning! Here's your coding interview problem for today.
This problem was recently asked by Google.
Given a list of numbers and a number k, return whether any two numbers from the list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
Bonus: Can ... | en | 0.897816 | #!/usr/bin/python3 Good morning! Here's your coding interview problem for today. This problem was recently asked by Google. Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. Bonus: Can you ... | 3.883942 | 4 |
gryphon/data/template_scaffolding/template/setup.py | ow-gryphon/gryphon | 0 | 8385 | import json
import setuptools
with open("template/README.md", "r") as fh:
long_description = fh.read()
with open('requirements.txt') as fr:
requirements = fr.read().strip().split('\n')
with open('metadata.json') as fr:
metadata = json.load(fr)
setuptools.setup(
name="", # Name of the repository
... | import json
import setuptools
with open("template/README.md", "r") as fh:
long_description = fh.read()
with open('requirements.txt') as fr:
requirements = fr.read().strip().split('\n')
with open('metadata.json') as fr:
metadata = json.load(fr)
setuptools.setup(
name="", # Name of the repository
... | en | 0.52538 | # Name of the repository # Repository URL or externally maintained page | 1.817157 | 2 |
train_base3.py | Mhaiyang/iccv | 2 | 8386 | """
@Time : 201/21/19 10:41
@Author : TaylorMei
@Email : <EMAIL>
@Project : iccv
@File : train_base3.py
@Function:
"""
import datetime
import os
import torch
from torch import nn
from torch import optim
from torch.autograd import Variable
from torch.backends import cudnn
from torch.utils.data import... | """
@Time : 201/21/19 10:41
@Author : TaylorMei
@Email : <EMAIL>
@Project : iccv
@File : train_base3.py
@Function:
"""
import datetime
import os
import torch
from torch import nn
from torch import optim
from torch.autograd import Variable
from torch.backends import cudnn
from torch.utils.data import... | en | 0.484448 | @Time : 201/21/19 10:41 @Author : TaylorMei @Email : <EMAIL> @Project : iccv @File : train_base3.py @Function: # Path. # Transform Data. # maybe can optimized. # Prepare Data Set. | 1.749567 | 2 |
tests/test_comment.py | uwase-diane/min_pitch | 1 | 8387 | import unittest
from app.models import Comment, Pitch
from app import db
class TestPitchComment(unittest.TestCase):
def setUp(self):
self.new_pitch = Pitch(post = "doit", category='Quotes')
self.new_comment = Comment(comment = "good comment", pitch=self.new_pitch)
def test_instance(se... | import unittest
from app.models import Comment, Pitch
from app import db
class TestPitchComment(unittest.TestCase):
def setUp(self):
self.new_pitch = Pitch(post = "doit", category='Quotes')
self.new_comment = Comment(comment = "good comment", pitch=self.new_pitch)
def test_instance(se... | none | 1 | 3.247295 | 3 | |
teacher/views.py | itteamforslp/safelife_project | 0 | 8388 | from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.template import loader
from django.db import connection
from django.http import HttpResponseRedirect
import datetime
from dj... | from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.template import loader
from django.db import connection
from django.http import HttpResponseRedirect
import datetime
from dj... | en | 0.91899 | #"""Limit view to teacher only.""" # Render the template to the user # Get the student name that was passed from the web page # Create a cursor to execute raw SQL queries. # Render the response to the user | 2.054544 | 2 |
botstory/middlewares/text/text_test.py | botstory/bot-story | 5 | 8389 | import logging
import pytest
import re
from . import text
from ... import matchers
from ...utils import answer, SimpleTrigger
logger = logging.getLogger(__name__)
@pytest.mark.asyncio
async def test_should_run_story_on_equal_message():
trigger = SimpleTrigger()
with answer.Talk() as talk:
story = ta... | import logging
import pytest
import re
from . import text
from ... import matchers
from ...utils import answer, SimpleTrigger
logger = logging.getLogger(__name__)
@pytest.mark.asyncio
async def test_should_run_story_on_equal_message():
trigger = SimpleTrigger()
with answer.Talk() as talk:
story = ta... | none | 1 | 2.229999 | 2 | |
pywikibot/site/_datasite.py | xqt/pwb | 0 | 8390 | <gh_stars>0
"""Objects representing API interface to Wikibase site."""
#
# (C) Pywikibot team, 2012-2022
#
# Distributed under the terms of the MIT license.
#
import datetime
import json
import uuid
from contextlib import suppress
from typing import Optional
from warnings import warn
import pywikibot
from pywikibot.da... | """Objects representing API interface to Wikibase site."""
#
# (C) Pywikibot team, 2012-2022
#
# Distributed under the terms of the MIT license.
#
import datetime
import json
import uuid
from contextlib import suppress
from typing import Optional
from warnings import warn
import pywikibot
from pywikibot.data import ap... | en | 0.549509 | Objects representing API interface to Wikibase site. # # (C) Pywikibot team, 2012-2022 # # Distributed under the terms of the MIT license. # Wikibase data capable site. Initializer. Find namespaces for each known wikibase entity type. Return namespace for given entity type. :return: corresponding namespace ... | 2.240608 | 2 |
app.py | MisaelVillaverde/fourier-calculator | 0 | 8391 | from flask import Flask
from flask import render_template, request
from flask import jsonify
import requests
import json
app = Flask(__name__)
@app.route("/symbo",methods=['POST'])
def symbo():
#import pdb; pdb.set_trace()
session = requests.session()
token = session.get("https://es.symbolab.com/solver/s... | from flask import Flask
from flask import render_template, request
from flask import jsonify
import requests
import json
app = Flask(__name__)
@app.route("/symbo",methods=['POST'])
def symbo():
#import pdb; pdb.set_trace()
session = requests.session()
token = session.get("https://es.symbolab.com/solver/s... | en | 0.354839 | #import pdb; pdb.set_trace() #response = json.loads(session.get(f"https://es.symbolab.com/pub_api/steps?subscribed=true&origin=input&language=es&query=%5Cint+tcos%5Cleft(nt%5Cright)dt+&referer=https%3A%2F%2Fes.symbolab.com%2Fsolver%2Fstep-by-step%2F%255Cint_%257B%2520%257Dtcos%255Cleft(nt%255Cright)dt%2520%3For%3Dinput... | 2.918962 | 3 |
my_code/Chapter_2.py | kalona/Spark-The-Definitive-Guide | 2 | 8392 | from pyspark.sql import SparkSession
# spark = SparkSession.builder.master("local[*]").getOrCreate()
spark = SparkSession.builder.getOrCreate()
file_path = "C:\home_work\local_github\Spark-The-Definitive-Guide\data\/flight-data\csv\/2015-summary.csv"
# COMMAND ----------
# COMMAND ----------
flightData2015 = spa... | from pyspark.sql import SparkSession
# spark = SparkSession.builder.master("local[*]").getOrCreate()
spark = SparkSession.builder.getOrCreate()
file_path = "C:\home_work\local_github\Spark-The-Definitive-Guide\data\/flight-data\csv\/2015-summary.csv"
# COMMAND ----------
# COMMAND ----------
flightData2015 = spa... | en | 0.294691 | # spark = SparkSession.builder.master("local[*]").getOrCreate() # COMMAND ---------- # COMMAND ---------- # COMMAND ---------- # COMMAND ---------- SELECT DEST_COUNTRY_NAME, count(1) FROM flight_data_2015 GROUP BY DEST_COUNTRY_NAME # COMMAND ---------- # # COMMAND ---------- SELECT DEST_COUNTRY_NAME, sum(count) as dest... | 3.209193 | 3 |
tests/test_intake_postgres.py | ContinuumIO/intake-postgres | 2 | 8393 | import os
import pickle
import pytest
import pandas as pd
from shapely import wkt
from intake_postgres import PostgresSource
from intake import open_catalog
from .util import verify_datasource_interface
TEST_DATA_DIR = 'tests'
TEST_DATA = [
('sample1', 'sample1.csv'),
('sample2_1', 'sample2_1.csv'),
('sa... | import os
import pickle
import pytest
import pandas as pd
from shapely import wkt
from intake_postgres import PostgresSource
from intake import open_catalog
from .util import verify_datasource_interface
TEST_DATA_DIR = 'tests'
TEST_DATA = [
('sample1', 'sample1.csv'),
('sample2_1', 'sample2_1.csv'),
('sa... | en | 0.687163 | # ('triangles', 'sample_triangles.psql'), Start docker container for PostgreSQL database, yield a tuple (engine, metadata), and cleanup connection afterward. Assert that after reading the dataframe, discover() shows more accurate information. # Can reopen after close | 2.065835 | 2 |
Module_3/testImage.py | dks1018/CoffeeShopCoding | 0 | 8394 | # file = open('C:\\Users\\dks10\\OneDrive\\Desktop\\Projects\\Code\\Python\\PythonCrypto\\Module_3\\eye.png', 'rb')
file = open('encrypt_eye.png', 'rb')
image = file.read()
file.close()
image = bytearray(image)
key = 48
for index, value in enumerate(image):
image[index] = value^key
file = open('2eye.png','wb')
... | # file = open('C:\\Users\\dks10\\OneDrive\\Desktop\\Projects\\Code\\Python\\PythonCrypto\\Module_3\\eye.png', 'rb')
file = open('encrypt_eye.png', 'rb')
image = file.read()
file.close()
image = bytearray(image)
key = 48
for index, value in enumerate(image):
image[index] = value^key
file = open('2eye.png','wb')
... | en | 0.293972 | # file = open('C:\\Users\\dks10\\OneDrive\\Desktop\\Projects\\Code\\Python\\PythonCrypto\\Module_3\\eye.png', 'rb') | 2.911926 | 3 |
ledfxcontroller/effects/temporal.py | Aircoookie/LedFx | 17 | 8395 | <reponame>Aircoookie/LedFx
import time
import logging
from ledfxcontroller.effects import Effect
from threading import Thread
import voluptuous as vol
_LOGGER = logging.getLogger(__name__)
DEFAULT_RATE = 1.0 / 60.0
@Effect.no_registration
class TemporalEffect(Effect):
_thread_active = False
_thread = None
... | import time
import logging
from ledfxcontroller.effects import Effect
from threading import Thread
import voluptuous as vol
_LOGGER = logging.getLogger(__name__)
DEFAULT_RATE = 1.0 / 60.0
@Effect.no_registration
class TemporalEffect(Effect):
_thread_active = False
_thread = None
CONFIG_SCHEMA = vol.Schem... | en | 0.91278 | # Treat the return value of the effect loop as a speed modifier # such that effects that are nartually faster or slower can have # a consistent feel. # Calculate the time to sleep accounting for potential heavy # frame assembly operations Triggered periodically based on the effect speed and any additional effe... | 2.667645 | 3 |
07/c/3 - Square Census.py | Surferlul/csc-python-solutions | 0 | 8396 | <gh_stars>0
n=int(input())
c = 1
while c**2 < n:
print(c**2)
c += 1
| n=int(input())
c = 1
while c**2 < n:
print(c**2)
c += 1 | none | 1 | 3.463962 | 3 | |
utils.py | LuChang-CS/sherbet | 2 | 8397 | import numpy as np
class DataGenerator:
def __init__(self, inputs, shuffle=True, batch_size=32):
assert len(inputs) > 0
self.inputs = inputs
self.idx = np.arange(len(inputs[0]))
self.shuffle = shuffle
self.batch_size = batch_size
self.on_epoch_end()
def data_le... | import numpy as np
class DataGenerator:
def __init__(self, inputs, shuffle=True, batch_size=32):
assert len(inputs) > 0
self.inputs = inputs
self.idx = np.arange(len(inputs[0]))
self.shuffle = shuffle
self.batch_size = batch_size
self.on_epoch_end()
def data_le... | none | 1 | 2.748842 | 3 | |
Version1_STI.py | sudhanshu55/Speech_to_Image | 0 | 8398 | from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
import speech_recognition as sr
import nltk
from google_images_download import google_images_download
response = google_images_download.googleimagesdownload()
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say some... | from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
import speech_recognition as sr
import nltk
from google_images_download import google_images_download
response = google_images_download.googleimagesdownload()
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say some... | en | 0.177993 | #creating list of arguments #passing the arguments to the function | 3.290518 | 3 |
src/models.py | jonathanlloyd/scratchstack-httpserver | 0 | 8399 | <gh_stars>0
from dataclasses import dataclass
@dataclass
class Request:
method: str
path: str
headers: dict
body: bytes
@dataclass
class Response:
status_code: int
reason_phrase: str
headers: dict
body: bytes
| from dataclasses import dataclass
@dataclass
class Request:
method: str
path: str
headers: dict
body: bytes
@dataclass
class Response:
status_code: int
reason_phrase: str
headers: dict
body: bytes | none | 1 | 2.44192 | 2 |