hexsha
string | size
int64 | ext
string | lang
string | max_stars_repo_path
string | max_stars_repo_name
string | max_stars_repo_head_hexsha
string | max_stars_repo_licenses
list | max_stars_count
int64 | max_stars_repo_stars_event_min_datetime
string | max_stars_repo_stars_event_max_datetime
string | max_issues_repo_path
string | max_issues_repo_name
string | max_issues_repo_head_hexsha
string | max_issues_repo_licenses
list | max_issues_count
int64 | max_issues_repo_issues_event_min_datetime
string | max_issues_repo_issues_event_max_datetime
string | max_forks_repo_path
string | max_forks_repo_name
string | max_forks_repo_head_hexsha
string | max_forks_repo_licenses
list | max_forks_count
int64 | max_forks_repo_forks_event_min_datetime
string | max_forks_repo_forks_event_max_datetime
string | content
string | avg_line_length
float64 | max_line_length
int64 | alphanum_fraction
float64 | qsc_code_num_words_quality_signal
int64 | qsc_code_num_chars_quality_signal
float64 | qsc_code_mean_word_length_quality_signal
float64 | qsc_code_frac_words_unique_quality_signal
float64 | qsc_code_frac_chars_top_2grams_quality_signal
float64 | qsc_code_frac_chars_top_3grams_quality_signal
float64 | qsc_code_frac_chars_top_4grams_quality_signal
float64 | qsc_code_frac_chars_dupe_5grams_quality_signal
float64 | qsc_code_frac_chars_dupe_6grams_quality_signal
float64 | qsc_code_frac_chars_dupe_7grams_quality_signal
float64 | qsc_code_frac_chars_dupe_8grams_quality_signal
float64 | qsc_code_frac_chars_dupe_9grams_quality_signal
float64 | qsc_code_frac_chars_dupe_10grams_quality_signal
float64 | qsc_code_frac_chars_replacement_symbols_quality_signal
float64 | qsc_code_frac_chars_digital_quality_signal
float64 | qsc_code_frac_chars_whitespace_quality_signal
float64 | qsc_code_size_file_byte_quality_signal
float64 | qsc_code_num_lines_quality_signal
float64 | qsc_code_num_chars_line_max_quality_signal
float64 | qsc_code_num_chars_line_mean_quality_signal
float64 | qsc_code_frac_chars_alphabet_quality_signal
float64 | qsc_code_frac_chars_comments_quality_signal
float64 | qsc_code_cate_xml_start_quality_signal
float64 | qsc_code_frac_lines_dupe_lines_quality_signal
float64 | qsc_code_cate_autogen_quality_signal
float64 | qsc_code_frac_lines_long_string_quality_signal
float64 | qsc_code_frac_chars_string_length_quality_signal
float64 | qsc_code_frac_chars_long_word_length_quality_signal
float64 | qsc_code_frac_lines_string_concat_quality_signal
float64 | qsc_code_cate_encoded_data_quality_signal
float64 | qsc_code_frac_chars_hex_words_quality_signal
float64 | qsc_code_frac_lines_prompt_comments_quality_signal
float64 | qsc_code_frac_lines_assert_quality_signal
float64 | qsc_codepython_cate_ast_quality_signal
float64 | qsc_codepython_frac_lines_func_ratio_quality_signal
float64 | qsc_codepython_cate_var_zero_quality_signal
bool | qsc_codepython_frac_lines_pass_quality_signal
float64 | qsc_codepython_frac_lines_import_quality_signal
float64 | qsc_codepython_frac_lines_simplefunc_quality_signal
float64 | qsc_codepython_score_lines_no_logic_quality_signal
float64 | qsc_codepython_frac_lines_print_quality_signal
float64 | qsc_code_num_words
int64 | qsc_code_num_chars
int64 | qsc_code_mean_word_length
int64 | qsc_code_frac_words_unique
null | qsc_code_frac_chars_top_2grams
int64 | qsc_code_frac_chars_top_3grams
int64 | qsc_code_frac_chars_top_4grams
int64 | qsc_code_frac_chars_dupe_5grams
int64 | qsc_code_frac_chars_dupe_6grams
int64 | qsc_code_frac_chars_dupe_7grams
int64 | qsc_code_frac_chars_dupe_8grams
int64 | qsc_code_frac_chars_dupe_9grams
int64 | qsc_code_frac_chars_dupe_10grams
int64 | qsc_code_frac_chars_replacement_symbols
int64 | qsc_code_frac_chars_digital
int64 | qsc_code_frac_chars_whitespace
int64 | qsc_code_size_file_byte
int64 | qsc_code_num_lines
int64 | qsc_code_num_chars_line_max
int64 | qsc_code_num_chars_line_mean
int64 | qsc_code_frac_chars_alphabet
int64 | qsc_code_frac_chars_comments
int64 | qsc_code_cate_xml_start
int64 | qsc_code_frac_lines_dupe_lines
int64 | qsc_code_cate_autogen
int64 | qsc_code_frac_lines_long_string
int64 | qsc_code_frac_chars_string_length
int64 | qsc_code_frac_chars_long_word_length
int64 | qsc_code_frac_lines_string_concat
null | qsc_code_cate_encoded_data
int64 | qsc_code_frac_chars_hex_words
int64 | qsc_code_frac_lines_prompt_comments
int64 | qsc_code_frac_lines_assert
int64 | qsc_codepython_cate_ast
int64 | qsc_codepython_frac_lines_func_ratio
int64 | qsc_codepython_cate_var_zero
int64 | qsc_codepython_frac_lines_pass
int64 | qsc_codepython_frac_lines_import
int64 | qsc_codepython_frac_lines_simplefunc
int64 | qsc_codepython_score_lines_no_logic
int64 | qsc_codepython_frac_lines_print
int64 | effective
string | hits
int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0a1e931ba097d20083af37bd3b556bc5ae0cee40
| 186
|
py
|
Python
|
src/border_patrol/with_log_debug.py
|
pyscaffold/border-patrol
|
f3098a63c31c391020cb498b4d59a4ecdf83bd6e
|
[
"MIT"
] | 9
|
2019-01-09T00:39:55.000Z
|
2022-03-04T12:01:26.000Z
|
src/border_patrol/with_log_debug.py
|
pyscaffold/border-patrol
|
f3098a63c31c391020cb498b4d59a4ecdf83bd6e
|
[
"MIT"
] | 2
|
2019-01-03T17:31:06.000Z
|
2019-01-04T17:13:20.000Z
|
src/border_patrol/with_log_debug.py
|
pyscaffold/border-patrol
|
f3098a63c31c391020cb498b4d59a4ecdf83bd6e
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
Import this module to let Border-Patrol use logging with level DEBUG
"""
from . import BorderPatrol, logger
BorderPatrol(report_fun=logger.debug).register()
| 23.25
| 68
| 0.731183
| 25
| 186
| 5.4
| 0.84
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006211
| 0.134409
| 186
| 7
| 69
| 26.571429
| 0.832298
| 0.489247
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
0a3ee5a4f80527a13809a4f00677f0112c5f0765
| 350
|
py
|
Python
|
users/arxiv/users/auth/sessions/__init__.py
|
cul-it/arxiv-accounts
|
9d237ffc7de4ac7f3c94ad615252681792f53fb5
|
[
"MIT"
] | 11
|
2018-12-29T17:55:16.000Z
|
2021-11-05T12:26:29.000Z
|
users/arxiv/users/auth/sessions/__init__.py
|
Https-github-com-sulaeman51/arxiv-auth
|
754fa083b0c8b43932f7393f5a4ab67d9f9f0444
|
[
"MIT"
] | 24
|
2019-01-25T18:19:21.000Z
|
2022-02-04T01:04:29.000Z
|
users/arxiv/users/auth/sessions/__init__.py
|
Https-github-com-sulaeman51/arxiv-auth
|
754fa083b0c8b43932f7393f5a4ab67d9f9f0444
|
[
"MIT"
] | 13
|
2019-01-10T22:01:43.000Z
|
2021-12-30T11:39:48.000Z
|
"""
Integration with the distributed session store.
In this implementation, we use a key-value store to hold session data
in JSON format. When a session is created, a cookie value is created (a
JSON web token) that contains information sufficient to retrieve the session.
See :mod:`.store`.
"""
from . import store
from .store import SessionStore
| 26.923077
| 77
| 0.771429
| 54
| 350
| 5
| 0.648148
| 0.066667
| 0.074074
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.165714
| 350
| 12
| 78
| 29.166667
| 0.924658
| 0.822857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
0a481b701a6579cdbf5ac07b3cbc4dc9c4fbc22b
| 2,906
|
py
|
Python
|
test/test_notifications_api.py
|
billforward/bf-python
|
d2b812329ca3ed1fd94364d7f46f69ad74665596
|
[
"Apache-2.0"
] | 2
|
2016-11-23T17:32:37.000Z
|
2022-02-24T05:13:20.000Z
|
test/test_notifications_api.py
|
billforward/bf-python
|
d2b812329ca3ed1fd94364d7f46f69ad74665596
|
[
"Apache-2.0"
] | null | null | null |
test/test_notifications_api.py
|
billforward/bf-python
|
d2b812329ca3ed1fd94364d7f46f69ad74665596
|
[
"Apache-2.0"
] | 1
|
2016-12-30T20:02:48.000Z
|
2016-12-30T20:02:48.000Z
|
# coding: utf-8
"""
BillForward REST API
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import
import os
import sys
import unittest
import billforward
from billforward.rest import ApiException
from billforward.apis.notifications_api import NotificationsApi
class TestNotificationsApi(unittest.TestCase):
""" NotificationsApi unit test stubs """
def setUp(self):
self.api = billforward.apis.notifications_api.NotificationsApi()
def tearDown(self):
pass
def test_ack_notification(self):
"""
Test case for ack_notification
Acknowledge a newly recevied notification.
"""
pass
def test_get_all_notifications(self):
"""
Test case for get_all_notifications
Returns a collection of all notifications. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_notification_by_entity_id(self):
"""
Test case for get_notification_by_entity_id
Returns a collection of notifications, specified by the entity-ID parameter. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_notification_by_id(self):
"""
Test case for get_notification_by_id
Returns a single notification, specified by the notification-ID parameter.
"""
pass
def test_get_notifications_by_webhook_id(self):
"""
Test case for get_notifications_by_webhook_id
Returns a collection of notification objects with created times within the period specified by the lower-threshold and upper-threshold parameters for the given webhook id. By default 10 values are returned. Records are returned in natural order.
"""
pass
def test_get_notifications_within_date_range(self):
"""
Test case for get_notifications_within_date_range
Returns a collection of notification objects with created times within the period specified by the lower-threshold and upper-threshold parameters. By default 10 values are returned. Records are returned in natural order.
"""
pass
if __name__ == '__main__':
unittest.main()
| 30.589474
| 253
| 0.709222
| 377
| 2,906
| 5.31565
| 0.360743
| 0.043912
| 0.032934
| 0.04491
| 0.418164
| 0.347305
| 0.315369
| 0.315369
| 0.281437
| 0.281437
| 0
| 0.007217
| 0.237096
| 2,906
| 94
| 254
| 30.914894
| 0.896707
| 0.616999
| 0
| 0.269231
| 1
| 0
| 0.009292
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.307692
| false
| 0.269231
| 0.269231
| 0
| 0.615385
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
0a51abe43733f64dc7f0adb1da324a326e57672c
| 120,207
|
py
|
Python
|
wikipedia__examples/hello_world.py
|
DazEB2/SimplePyScripts
|
1dde0a42ba93fe89609855d6db8af1c63b1ab7cc
|
[
"CC-BY-4.0"
] | 117
|
2015-12-18T07:18:27.000Z
|
2022-03-28T00:25:54.000Z
|
wikipedia__examples/hello_world.py
|
DazEB2/SimplePyScripts
|
1dde0a42ba93fe89609855d6db8af1c63b1ab7cc
|
[
"CC-BY-4.0"
] | 8
|
2018-10-03T09:38:46.000Z
|
2021-12-13T19:51:09.000Z
|
wikipedia__examples/hello_world.py
|
DazEB2/SimplePyScripts
|
1dde0a42ba93fe89609855d6db8af1c63b1ab7cc
|
[
"CC-BY-4.0"
] | 28
|
2016-08-02T17:43:47.000Z
|
2022-03-21T08:31:12.000Z
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://pypi.org/project/wikipedia/
# SOURCE: https://wikipedia.readthedocs.io/en/latest/quickstart.html
# pip install wikipedia
import wikipedia
print(wikipedia.summary("Wikipedia"))
# Wikipedia ( (listen) wik-ih-PEE-dee-ə or (listen) wik-ee-PEE-dee-ə) is a multilingual online encyclopedia created and maintained as an open collaboration project by a community of volunteer editors using a wiki-based editing system. It is the largest and most popular general reference work on the World Wide Web, and is one of the most popular websites ranked by Alexa as of October 2019. It features exclusively free content and no commercial ads, and is owned and supported by the Wikimedia Foundation, a non-profit organization funded primarily through donations.Wikipedia was launched on January 15, 2001, by Jimmy Wales and Larry Sanger. Sanger coined its name, as a portmanteau of "wiki" (the Hawaiian word for "quick") and "encyclopedia". While it was Initially an English-language encyclopedia, versions in other languages were quickly developed. With at least 5,972,341 articles, the English Wikipedia is the largest of the more than 290 Wikipedia encyclopedias. Overall, Wikipedia comprises more than 40 million articles in 301 different languages and by February 2014 it had reached 18 billion page views and nearly 500 million unique visitors per month.In 2005, Nature published a peer review comparing 42 hard science articles from Encyclopædia Britannica and Wikipedia and found that Wikipedia's level of accuracy approached that of Britannica, although critics suggested that it might not have fared so well in a similar study of a random sampling of all articles or one focused on social science or contentious social issues. The following year, Time magazine stated that the open-door policy of allowing anyone to edit had made Wikipedia the biggest and possibly the best encyclopedia in the world, and was a testament to the vision of Jimmy Wales.Wikipedia has been criticized for exhibiting systemic bias, for presenting a mixture of "truth, half truth, and some falsehoods", and for being subject to manipulation and spin in controversial topics. In addition, Wikipedia has gender bias, particularly on its English-language site, where the dominant majority of editors are male. However, Edit-a-thons have been held to encourage female editors and increase the coverage of women's topics. Facebook announced that by 2017 it would help readers detect fake news by suggesting links to related Wikipedia articles. YouTube announced a similar plan in 2018.
print()
print(wikipedia.search("Barack"))
# ['Barack Obama', 'Barack Obama Sr.', 'Family of Barack Obama', 'Presidency of Barack Obama', 'Barack Obama citizenship conspiracy theories', 'Barack (disambiguation)', 'Barack Obama religion conspiracy theories', 'United States presidential approval rating', 'Efforts to impeach Barack Obama', 'Barack Obama (disambiguation)']
print()
ny = wikipedia.page("New York City")
print(ny) # <WikipediaPage 'New York City'>
print(ny.title) # New York City
print(ny.url) # https://en.wikipedia.org/wiki/New_York_City
print(repr(ny.content)) # 'The City of New York, usually referred to as either New York City (NYC) or simply New York (NY), is the most populous city in the United States. With an estimated 2018 population of 8,398,748 distributed over a land area of about 302.6 square miles (784 km2), New York is also the most densely populated major city in the United States. Located at the southern tip of the state of New York, the city is the center of the New York metropolitan area, the largest metropolitan area in the world by urban landmass and one of the world\'s most populous megacities, with an estimated 19,979,477 people in its 2018 Metropolitan Statistical Area and 22,679,948 residents in its Combined Statistical Area. A global power city, New York City has been described as the cultural, financial, and media capital of the world, and exerts a significant impact upon commerce, entertainment, research, technology, education, politics, tourism, art, fashion, and sports. The city\'s fast pace has inspired the term New York minute. Home to the headquarters of the United Nations, New York is an important center for international diplomacy.Situated on one of the world\'s largest natural harbors, New York City consists of five boroughs, each of which is a separate county of the State of New York. The five boroughs – Brooklyn, Queens, Manhattan, The Bronx, and Staten Island – were consolidated into a single city in 1898. The city and its metropolitan area constitute the premier gateway for legal immigration to the United States. As many as 800 languages are spoken in New York, making it the most linguistically diverse city in the world. New York City is home to more than 3.2 million residents born outside the United States, the largest foreign-born population of any city in the world. As of 2019, the New York metropolitan area is estimated to produce a gross metropolitan product (GMP) of US$1.9 trillion. If greater New York City were a sovereign state, it would have the 12th highest GDP in the world. New York is home to the highest number of billionaires of any city in the world.New York City traces its origins to a trading post founded by colonists from the Dutch Republic in 1624 on Lower Manhattan; the post was named New Amsterdam in 1626. The city and its surroundings came under English control in 1664 and were renamed New York after King Charles II of England granted the lands to his brother, the Duke of York. New York was the capital of the United States from 1785 until 1790, and has been the largest US city since 1790. The Statue of Liberty greeted millions of immigrants as they came to the U.S. by ship in the late 19th and early 20th centuries and is an international symbol of the U.S. and its ideals of liberty and peace. In the 21st century, New York has emerged as a global node of creativity and entrepreneurship, social tolerance, and environmental sustainability, and as a symbol of freedom and cultural diversity. In 2019, New York was voted the greatest city in the world per a survey of over 30,000 people from 48 cities worldwide, citing its cultural diversity.Many districts and landmarks in New York City are well known, including three of the world\'s ten most visited tourist attractions in 2013; a record 62.8 million tourists visited in 2017. Several sources have ranked New York the most photographed city in the world. Times Square, iconic as the world\'s "heart" and "crossroads", is the brightly illuminated hub of the Broadway Theater District, one of the world\'s busiest pedestrian intersections, and a major center of the world\'s entertainment industry. The names of many of the city\'s landmarks, skyscrapers, and parks are known internationally. Manhattan\'s real estate market is among the most expensive in the world. New York is home to the largest ethnic Chinese population outside of Asia, with multiple distinct Chinatowns across the city. Providing continuous 24/7 service, the New York City Subway is the largest single-operator rapid transit system worldwide, with 472 rail stations. The city has over 120 colleges and universities, including Columbia University, New York University, and Rockefeller University, ranked among the top universities in the world. Anchored by Wall Street in the Financial District of Lower Manhattan, New York has been called both the most economically powerful city and world\'s leading financial center, and is home to the world\'s two largest stock exchanges by total market capitalization, the New York Stock Exchange and NASDAQ.\n\n\n== History ==\n\n\n=== Etymology ===\nIn 1664, the city was named in honor of the Duke of York, who would become King James II of England. James\'s older brother, King Charles II, had appointed the Duke proprietor of the former territory of New Netherland, including the city of New Amsterdam, which England had recently seized from the Dutch.\n\n\n=== Early history ===\nDuring the Wisconsin glaciation, 75,000 to 11,000 years ago, the New York City region was situated at the edge of a large ice sheet over 2,000 feet (610 m) in depth. The erosive forward movement of the ice (and its subsequent retreat) contributed to the separation of what is now Long Island and Staten Island. That action also left bedrock at a relatively shallow depth, providing a solid foundation for most of Manhattan\'s skyscrapers.In the precolonial era, the area of present-day New York City was inhabited by Algonquian Native Americans, including the Lenape. Their homeland, known as Lenapehoking, included Staten Island, Manhattan, the Bronx, the western portion of Long Island (including the areas that would later become the boroughs of Brooklyn and Queens), and the Lower Hudson Valley.The first documented visit into New York Harbor by a European was in 1524 by Giovanni da Verrazzano, a Florentine explorer in the service of the French crown. He claimed the area for France and named it Nouvelle Angoulême (New Angoulême). A Spanish expedition, led by the Portuguese captain Estêvão Gomes sailing for Emperor Charles V, arrived in New York Harbor in January 1525 and charted the mouth of the Hudson River, which he named Río de San Antonio (Saint Anthony\'s River). The Padrón Real of 1527, the first scientific map to show the East Coast of North America continuously, was informed by Gomes\' expedition and labeled the northeastern United States as Tierra de Esteban Gómez in his honor.\n\nIn 1609, the English explorer Henry Hudson rediscovered the New York Harbor while searching for the Northwest Passage to the Orient for the Dutch East India Company. He proceeded to sail up what the Dutch would name the North River (now the Hudson River), named first by Hudson as the Mauritius after Maurice, Prince of Orange. Hudson\'s first mate described the harbor as "a very good Harbour for all windes" and the river as "a mile broad" and "full of fish." Hudson sailed roughly 150 miles (240 km) north, past the site of the present-day New York State capital city of Albany, in the belief that it might be an oceanic tributary before the river became too shallow to continue. He made a ten-day exploration of the area and claimed the region for the Dutch East India Company. In 1614, the area between Cape Cod and Delaware Bay was claimed by the Netherlands and called Nieuw-Nederland (New Netherland).\nThe first non-Native American inhabitant of what would eventually become New York City was Juan Rodriguez (transliterated to Dutch as Jan Rodrigues), a merchant from Santo Domingo. Born in Santo Domingo of Portuguese and African descent, he arrived in Manhattan during the winter of 1613–14, trapping for pelts and trading with the local population as a representative of the Dutch. Broadway, from 159th Street to 218th Street in Upper Manhattan, is named Juan Rodriguez Way in his honor.\n\n\n=== Dutch rule ===\n\nA permanent European presence in New Netherland began in 1624 – making New York the 12th oldest continuously occupied European-established settlement in the continental United States – with the founding of a Dutch fur trading settlement on Governors Island. In 1625, construction was started on a citadel and Fort Amsterdam, later called Nieuw Amsterdam (New Amsterdam), on present-day Manhattan Island. The colony of New Amsterdam was centered at the site which would eventually become Lower Manhattan. It extended from the lower tip of Manhattan to modern day Wall Street,where a 12-foot wooden stockade was built in 1653 to protect against Native American and British Raids. In 1626, the Dutch colonial Director-General Peter Minuit, acting as charged by the Dutch West India Company, purchased the island of Manhattan from the Canarsie, a small Lenape band, for "the value of 60 guilders" (about $900 in 2018). A disproved legend claims that Manhattan was purchased for $24 worth of glass beads.Following the purchase, New Amsterdam grew slowly. To attract settlers, the Dutch instituted the patroon system in 1628, whereby wealthy Dutchmen (patroons, or patrons) who brought 50 colonists to New Netherland would be awarded swathes of land, along with local political autonomy and rights to participate in the lucrative fur trade. This program had little success.Since 1621, the Dutch West India Company had operated as a monopoly in New Netherland, on authority granted by the Dutch States General. In 1639–1640, in an effort to bolster economic growth, the Dutch West India Company relinquished its monopoly over the fur trade, leading to growth in the production and trade of food, timber, tobacco, and slaves (particularly with the Dutch West Indies).In 1647, Peter Stuyvesant began his tenure as the last Director-General of New Netherland. During his tenure, the population of New Netherland grew from 2,000 to 8,000. Stuyvesant has been credited with improving law and order in the colony; however, he also earned a reputation as a despotic leader. He instituted regulations on liquor sales, attempted to assert control over the Dutch Reformed Church, and blocked other religious groups (including Quakers, Jews, and Lutherans) from establishing houses of worship. The Dutch West India Company would eventually attempt to ease tensions between Stuyvesant and residents of New Amsterdam.\n\n\n=== English rule ===\n\nIn 1664, unable to summon any significant resistance, Stuyvesant surrendered New Amsterdam to English troops, led by Colonel Richard Nicolls, without bloodshed. The terms of the surrender permitted Dutch residents to remain in the colony and allowed for religious freedom. The English promptly renamed the fledgling city "New York" after the Duke of York (the future King James II of England). The transfer was confirmed in 1667 by the Treaty of Breda, which concluded the Second Anglo-Dutch War.On August 24, 1673, during the Third Anglo-Dutch War, Dutch captain Anthony Colve seized the colony of New York from England at the behest of Cornelis Evertsen the Youngest and rechristened it "New Orange" after William III, the Prince of Orange. The Dutch would soon return the island to England under the Treaty of Westminster of November 1674.Several intertribal wars among the Native Americans and some epidemics brought on by contact with the Europeans caused sizeable population losses for the Lenape between the years 1660 and 1670. By 1700, the Lenape population had diminished to 200. New York experienced several yellow fever epidemics in the 18th century, losing ten percent of its population to the disease in 1702 alone.New York grew in importance as a trading port while under British rule in the early 1700s. It also became a center of slavery, with 42% of households holding slaves by 1730, the highest percentage outside Charleston, South Carolina. Most slaveholders held a few or several domestic slaves, but others hired them out to work at labor. Slavery became integrally tied to New York\'s economy through the labor of slaves throughout the port, and the banks and shipping tied to the American South. Discovery of the African Burying Ground in the 1990s, during construction of a new federal courthouse near Foley Square, revealed that tens of thousands of Africans had been buried in the area in the colonial years.The 1735 trial and acquittal in Manhattan of John Peter Zenger, who had been accused of seditious libel after criticizing colonial governor William Cosby, helped to establish the freedom of the press in North America. In 1754, Columbia University was founded under charter by King George II as King\'s College in Lower Manhattan.\n\n\n=== American Revolution ===\n\nThe Stamp Act Congress met in New York in October 1765, as the Sons of Liberty, organized in the city, skirmished over the next ten years with British troops stationed there. The Battle of Long Island, the largest battle of the American Revolutionary War, was fought in August 1776 within the modern-day borough of Brooklyn. After the battle, in which the Americans were defeated, the British made the city their military and political base of operations in North America. The city was a haven for Loyalist refugees and escaped slaves who joined the British lines for freedom newly promised by the Crown for all fighters. As many as 10,000 escaped slaves crowded into the city during the British occupation. When the British forces evacuated at the close of the war in 1783, they transported 3,000 freedmen for resettlement in Nova Scotia. They resettled other freedmen in England and the Caribbean.\nThe only attempt at a peaceful solution to the war took place at the Conference House on Staten Island between American delegates, including Benjamin Franklin, and British general Lord Howe on September 11, 1776. Shortly after the British occupation began, the Great Fire of New York occurred, a large conflagration on the West Side of Lower Manhattan, which destroyed about a quarter of the buildings in the city, including Trinity Church.In 1785, the assembly of the Congress of the Confederation made New York City the national capital shortly after the war. New York was the last capital of the U.S. under the Articles of Confederation and the first capital under the Constitution of the United States. In 1789, the first President of the United States, George Washington, was inaugurated; the first United States Congress and the Supreme Court of the United States each assembled for the first time, and the United States Bill of Rights was drafted, all at Federal Hall on Wall Street. By 1790, New York had surpassed Philadelphia to become the largest city in the United States, but by the end of that year, pursuant to the Residence Act, the national capital was moved to Philadelphia.\n\n\n=== Nineteenth century ===\n\nUnder New York State\'s gradual abolition act of 1799, children of slave mothers were to be eventually liberated but to be held in indentured servitude until their mid-to-late twenties. Together with slaves freed by their masters after the Revolutionary War and escaped slaves, a significant free-black population gradually developed in Manhattan. Under such influential United States founders as Alexander Hamilton and John Jay, the New York Manumission Society worked for abolition and established the African Free School to educate black children. It was not until 1827 that slavery was completely abolished in the state, and free blacks struggled afterward with discrimination. New York interracial abolitionist activism continued; among its leaders were graduates of the African Free School. The city\'s black population reached more than 16,000 in 1840.In the 19th century, the city was transformed by development relating to its status as a national and international trading center, as well as by European immigration. The city adopted the Commissioners\' Plan of 1811, which expanded the city street grid to encompass almost all of Manhattan. The 1825 completion of the Erie Canal through central New York connected the Atlantic port to the agricultural markets and commodities of the North American interior via the Hudson River and the Great Lakes. Local politics became dominated by Tammany Hall, a political machine supported by Irish and German immigrants.Several prominent American literary figures lived in New York during the 1830s and 1840s, including William Cullen Bryant, Washington Irving, Herman Melville, Rufus Wilmot Griswold, John Keese, Nathaniel Parker Willis, and Edgar Allan Poe. Public-minded members of the contemporaneous business elite lobbied for the establishment of Central Park, which in 1857 became the first landscaped park in an American city.\n\nThe Great Irish Famine brought a large influx of Irish immigrants, of whom over 200,000 were living in New York by 1860, upwards of a quarter of the city\'s population. There was also extensive immigration from the German provinces, where revolutions had disrupted societies, and Germans comprised another 25% of New York\'s population by 1860.Democratic Party candidates were consistently elected to local office, increasing the city\'s ties to the South and its dominant party. In 1861, Mayor Fernando Wood called upon the aldermen to declare independence from Albany and the United States after the South seceded, but his proposal was not acted on. Anger at new military conscription laws during the American Civil War (1861–1865), which spared wealthier men who could afford to pay a $300 (equivalent to $6,105 in 2018) commutation fee to hire a substitute, led to the Draft Riots of 1863, whose most visible participants were ethnic Irish working class.The situation deteriorated into attacks on New York\'s elite, followed by attacks on Black New Yorkers and their property after fierce competition for a decade between Irish immigrants and black people for work. Rioters burned the Colored Orphan Asylum to the ground, with more than 200 children escaping harm due to efforts of the New York Police Department, which was mainly made up of Irish immigrants. At least 120 people were killed. Eleven Black men were lynched over five days, and the riots forced hundreds of Blacks to flee the city for Williamsburg, Brooklyn, and New Jersey. The black population in Manhattan fell below 10,000 by 1865, which it had last been in 1820. The white working class had established dominance. Violence by longshoremen against Black men was especially fierce in the docks area. It was one of the worst incidents of civil unrest in American history.\n\n\n=== Modern history ===\n\nIn 1898, the modern City of New York was formed with the consolidation of Brooklyn (until then a separate city), the County of New York (which then included parts of the Bronx), the County of Richmond, and the western portion of the County of Queens. The opening of the subway in 1904, first built as separate private systems, helped bind the new city together. Throughout the first half of the 20th century, the city became a world center for industry, commerce, and communication.In 1904, the steamship General Slocum caught fire in the East River, killing 1,021 people on board. In 1911, the Triangle Shirtwaist Factory fire, the city\'s worst industrial disaster, took the lives of 146 garment workers and spurred the growth of the International Ladies\' Garment Workers\' Union and major improvements in factory safety standards.\n\nNew York\'s non-white population was 36,620 in 1890. New York City was a prime destination in the early twentieth century for African Americans during the Great Migration from the American South, and by 1916, New York City had become home to the largest urban African diaspora in North America. The Harlem Renaissance of literary and cultural life flourished during the era of Prohibition. The larger economic boom generated construction of skyscrapers competing in height and creating an identifiable skyline.\nNew York became the most populous urbanized area in the world in the early 1920s, overtaking London. The metropolitan area surpassed the 10 million mark in the early 1930s, becoming the first megacity in human history. The difficult years of the Great Depression saw the election of reformer Fiorello La Guardia as mayor and the fall of Tammany Hall after eighty years of political dominance.Returning World War II veterans created a post-war economic boom and the development of large housing tracts in eastern Queens and Nassau County as well as similar suburban areas in New Jersey. New York emerged from the war unscathed as the leading city of the world, with Wall Street leading America\'s place as the world\'s dominant economic power. The United Nations Headquarters was completed in 1952, solidifying New York\'s global geopolitical influence, and the rise of abstract expressionism in the city precipitated New York\'s displacement of Paris as the center of the art world.\n\nThe Stonewall riots were a series of spontaneous, violent demonstrations by members of the gay community against a police raid that took place in the early morning hours of June 28, 1969, at the Stonewall Inn in the Greenwich Village neighborhood of Lower Manhattan. They are widely considered to constitute the single most important event leading to the gay liberation movement and the modern fight for LGBT rights. Wayne R. Dynes, author of the Encyclopedia of Homosexuality, wrote that drag queens were the only "transgender folks around" during the June 1969 Stonewall riots. "None of them in fact made a major contribution to the movement." Others say the transgender community in New York City played a significant role in fighting for LGBT equality during the period of the Stonewall riots and thereafter.In the 1970s, job losses due to industrial restructuring caused New York City to suffer from economic problems and rising crime rates. While a resurgence in the financial industry greatly improved the city\'s economic health in the 1980s, New York\'s crime rate continued to increase through that decade and into the beginning of the 1990s. By the mid 1990s, crime rates started to drop dramatically due to revised police strategies, improving economic opportunities, gentrification, and new residents, both American transplants and new immigrants from Asia and Latin America. Important new sectors, such as Silicon Alley, emerged in the city\'s economy. New York\'s population reached all-time highs in the 2000 Census and then again in the 2010 Census.\n\nNew York suffered the bulk of the economic damage and largest loss of human life in the aftermath of the September 11, 2001 attacks. Two of the four airliners highjacked that day were flown into the twin towers of the World Trade Center, destroying them and killing 2,192 civilians, 343 firefighters, and 71 law enforcement officers. The North Tower became the tallest building ever to be destroyed anywhere then or subsequently.The rebuilding of the area has created a new One World Trade Center, and a 9/11 memorial and museum along with other new buildings and infrastructure. The World Trade Center PATH station, which had opened on July 19, 1909 as the Hudson Terminal, was also destroyed in the attack. A temporary station was built and opened on November 23, 2003. An 800,000-square-foot (74,000 m2) permanent rail station designed by Santiago Calatrava, the World Trade Center Transportation Hub, the city\'s third-largest hub, was completed in 2016. The new One World Trade Center is the tallest skyscraper in the Western Hemisphere and the sixth-tallest building in the world by pinnacle height, with its spire reaching a symbolic 1,776 feet (541.3 m) in reference to the year of U.S. independence.The Occupy Wall Street protests in Zuccotti Park in the Financial District of Lower Manhattan began on September 17, 2011, receiving global attention and popularizing the Occupy movement against social and economic inequality worldwide.\n\n\n== Geography ==\n\nNew York City is situated in the Northeastern United States, in southeastern New York State, approximately halfway between Washington, D.C. and Boston. The location at the mouth of the Hudson River, which feeds into a naturally sheltered harbor and then into the Atlantic Ocean, has helped the city grow in significance as a trading port. Most of New York City is built on the three islands of Long Island, Manhattan, and Staten Island.\nThe Hudson River flows through the Hudson Valley into New York Bay. Between New York City and Troy, New York, the river is an estuary. The Hudson River separates the city from the U.S. state of New Jersey. The East River—a tidal strait—flows from Long Island Sound and separates the Bronx and Manhattan from Long Island. The Harlem River, another tidal strait between the East and Hudson Rivers, separates most of Manhattan from the Bronx. The Bronx River, which flows through the Bronx and Westchester County, is the only entirely fresh water river in the city.The city\'s land has been altered substantially by human intervention, with considerable land reclamation along the waterfronts since Dutch colonial times; reclamation is most prominent in Lower Manhattan, with developments such as Battery Park City in the 1970s and 1980s. Some of the natural relief in topography has been evened out, especially in Manhattan.The city\'s total area is 468.484 square miles (1,213.37 km2), including 302.643 sq mi (783.84 km2) of land and 165.841 sq mi (429.53 km2) of this is water.\nThe highest point in the city is Todt Hill on Staten Island, which, at 409.8 feet (124.9 m) above sea level, is the highest point on the Eastern Seaboard south of Maine. The summit of the ridge is mostly covered in woodlands as part of the Staten Island Greenbelt.\n\n\n=== Boroughs ===\n\n \n\nNew York City is often referred to collectively as the five boroughs, and in turn, there are hundreds of distinct neighborhoods throughout the boroughs, many with a definable history and character to call their own. If the boroughs were each independent cities, four of the boroughs (Brooklyn, Queens, Manhattan, and the Bronx) would be among the ten most populous cities in the United States (Staten Island would be ranked 37th) ; these same boroughs are coterminous with the four most densely populated counties in the United States (New York [Manhattan], Kings [Brooklyn], Bronx, and Queens).\n\nManhattan (New York County) is the geographically smallest and most densely populated borough, is home to Central Park and most of the city\'s skyscrapers, and may be locally known simply as The City. Manhattan\'s (New York County\'s) population density of 72,033 people per square mile (27,812/km²) in 2015 makes it the highest of any county in the United States and higher than the density of any individual American city. Manhattan is the cultural, administrative, and financial center of New York City and contains the headquarters of many major multinational corporations, the United Nations Headquarters, Wall Street, and a number of important universities. Manhattan is often described as the financial and cultural center of the world.Most of the borough is situated on Manhattan Island, at the mouth of the Hudson River. Several small islands also compose part of the borough of Manhattan, including Randall\'s Island, Wards Island, and Roosevelt Island in the East River, and Governors Island and Liberty Island to the south in New York Harbor. Manhattan Island is loosely divided into Lower, Midtown, and Uptown regions. Uptown Manhattan is divided by Central Park into the Upper East Side and the Upper West Side, and above the park is Harlem. The borough also includes a small neighborhood on the United States mainland, called Marble Hill, which is contiguous with The Bronx. New York City\'s remaining four boroughs are collectively referred to as the outer boroughs.\nBrooklyn (Kings County), on the western tip of Long Island, is the city\'s most populous borough. Brooklyn is known for its cultural, social, and ethnic diversity, an independent art scene, distinct neighborhoods, and a distinctive architectural heritage. Downtown Brooklyn is the largest central core neighborhood in the outer boroughs. The borough has a long beachfront shoreline including Coney Island, established in the 1870s as one of the earliest amusement grounds in the country. Marine Park and Prospect Park are the two largest parks in Brooklyn. Since 2010, Brooklyn has evolved into a thriving hub of entrepreneurship and high technology startup firms, and of postmodern art and design.\nQueens (Queens County), on Long Island north and east of Brooklyn, is geographically the largest borough, the most ethnically diverse county in the United States, and the most ethnically diverse urban area in the world. Historically a collection of small towns and villages founded by the Dutch, the borough has since developed both commercial and residential prominence. Downtown Flushing has become one of the busiest central core neighborhoods in the outer boroughs. Queens is the site of Citi Field, the baseball stadium of the New York Mets, and hosts the annual U.S. Open tennis tournament at Flushing Meadows-Corona Park. Additionally, two of the three busiest airports serving the New York metropolitan area, John F. Kennedy International Airport and LaGuardia Airport, are located in Queens. (The third is Newark Liberty International Airport in Newark, New Jersey.)\nThe Bronx (Bronx County) is New York City\'s northernmost borough and the only New York City borough with a majority of it a part of the mainland United States. It is the location of Yankee Stadium, the baseball park of the New York Yankees, and home to the largest cooperatively owned housing complex in the United States, Co-op City. It is also home to the Bronx Zoo, the world\'s largest metropolitan zoo, which spans 265 acres (1.07 km2) and houses over 6,000 animals. The Bronx is also the birthplace of rap and hip hop culture. Pelham Bay Park is the largest park in New York City, at 2,772 acres (1,122 ha).\nStaten Island (Richmond County) is the most suburban in character of the five boroughs. Staten Island is connected to Brooklyn by the Verrazano-Narrows Bridge, and to Manhattan by way of the free Staten Island Ferry, a daily commuter ferry which provides unobstructed views of the Statue of Liberty, Ellis Island, and Lower Manhattan. In central Staten Island, the Staten Island Greenbelt spans approximately 2,500 acres (10 km2), including 28 miles (45 km) of walking trails and one of the last undisturbed forests in the city. Designated in 1984 to protect the island\'s natural lands, the Greenbelt comprises seven city parks.\n\n\n=== Architecture ===\n\nNew York has architecturally noteworthy buildings in a wide range of styles and from distinct time periods, from the saltbox style Pieter Claesen Wyckoff House in Brooklyn, the oldest section of which dates to 1656, to the modern One World Trade Center, the skyscraper at Ground Zero in Lower Manhattan and the most expensive office tower in the world by construction cost.Manhattan\'s skyline, with its many skyscrapers, is universally recognized, and the city has been home to several of the tallest buildings in the world. As of 2019, New York City had 6,455 high-rise buildings, the third most in world after Hong Kong and Seoul. Of these, as of 2011, 550 completed structures were at least 330 feet (100 m) high, the second most in the world after Hong Kong, with over 50 completed skyscrapers taller than 656 feet (200 m). These include the Woolworth Building, an early example of Gothic Revival architecture in skyscraper design, built with massively scaled Gothic detailing; completed in 1913, for 17 years it was the world\'s tallest building.The 1916 Zoning Resolution required setbacks in new buildings and restricted towers to a percentage of the lot size, to allow sunlight to reach the streets below. The Art Deco style of the Chrysler Building (1930) and Empire State Building (1931), with their tapered tops and steel spires, reflected the zoning requirements. The buildings have distinctive ornamentation, such as the eagles at the corners of the 61st floor on the Chrysler Building, and are considered some of the finest examples of the Art Deco style. A highly influential example of the international style in the United States is the Seagram Building (1957), distinctive for its façade using visible bronze-toned I-beams to evoke the building\'s structure. The Condé Nast Building (2000) is a prominent example of green design in American skyscrapers and has received an award from the American Institute of Architects and AIA New York State for its design.\nThe character of New York\'s large residential districts is often defined by the elegant brownstone rowhouses and townhouses and shabby tenements that were built during a period of rapid expansion from 1870 to 1930. In contrast, New York City also has neighborhoods that are less densely populated and feature free-standing dwellings. In neighborhoods such as Riverdale (in the Bronx), Ditmas Park (in Brooklyn), and Douglaston (in Queens), large single-family homes are common in various architectural styles such as Tudor Revival and Victorian.Stone and brick became the city\'s building materials of choice after the construction of wood-frame houses was limited in the aftermath of the Great Fire of 1835. A distinctive feature of many of the city\'s buildings is the roof-mounted wooden water tower. In the 1800s, the city required their installation on buildings higher than six stories to prevent the need for excessively high water pressures at lower elevations, which could break municipal water pipes. Garden apartments became popular during the 1920s in outlying areas, such as Jackson Heights.According to the United States Geological Survey, an updated analysis of seismic hazard in July 2014 revealed a "slightly lower hazard for tall buildings" in New York City than previously assessed. Scientists estimated this lessened risk based upon a lower likelihood than previously thought of slow shaking near the city, which would be more likely to cause damage to taller structures from an earthquake in the vicinity of the city.\n\n\n=== Climate ===\n\nUnder the Köppen climate classification, using the 0 °C (32 °F) isotherm, New York City features a humid subtropical climate (Cfa), and is thus the northernmost major city on the North American continent with this categorization. The suburbs to the immediate north and west lie in the transitional zone between humid subtropical and humid continental climates (Dfa). For the Trewartha classification, it is defined as an oceanic climate (Do). Annually, the city averages 234 days with at least some sunshine. The city lies in the USDA 7b plant hardiness zone.Winters are cold and damp, and prevailing wind patterns that blow sea breezes offshore temper the moderating effects of the Atlantic Ocean; yet the Atlantic and the partial shielding from colder air by the Appalachian Mountains keep the city warmer in the winter than inland North American cities at similar or lesser latitudes such as Pittsburgh, Cincinnati, and Indianapolis. The daily mean temperature in January, the area\'s coldest month, is 32.6 °F (0.3 °C); temperatures usually drop to 10 °F (−12 °C) several times per winter, and reach 60 °F (16 °C) several days in the coldest winter month. Spring and autumn are unpredictable and can range from chilly to warm, although they are usually mild with low humidity. Summers are typically warm to hot and humid, with a daily mean temperature of 76.5 °F (24.7 °C) in July.Nighttime conditions are often exacerbated by the urban heat island phenomenon, while daytime temperatures exceed 90 °F (32 °C) on average of 17 days each summer and in some years exceed 100 °F (38 °C), although the last time this happened was July 23, 2011. Extreme temperatures have ranged from −15 °F (−26 °C), recorded on February 9, 1934, up to 106 °F (41 °C) on July 9, 1936; the coldest recorded wind chill was −37 °F (−38 °C) on the same day as the all-time record low. The record cold daily maximum was 2 °F (−17 °C) on December 30, 1917, while, conversely, the record warm daily minimum was 84 °F (29 °C), last recorded on July 22, 2011. The average water temperature of the nearby Atlantic Ocean ranges from 39.7 °F (4.3 °C) in February to 74.1 °F (23.4 °C) in August.The city receives 49.9 inches (1,270 mm) of precipitation annually, which is relatively evenly spread throughout the year. Average winter snowfall between 1981 and 2010 has been 25.8 inches (66 cm); this varies considerably between years. Hurricanes and tropical storms are rare in the New York area. Hurricane Sandy brought a destructive storm surge to New York City on the evening of October 29, 2012, flooding numerous streets, tunnels, and subway lines in Lower Manhattan and other areas of the city and cutting off electricity in many parts of the city and its suburbs. The storm and its profound impacts have prompted the discussion of constructing seawalls and other coastal barriers around the shorelines of the city and the metropolitan area to minimize the risk of destructive consequences from another such event in the future.The warmest month on record is July 1999, with a mean temperature of 81.4 °F (27.4 °C). The coldest month was February 1934, with a mean temperature of 19.9 °F (−6.7 °C). The warmest year on record is 2012, with a mean temperature of 57.4 °F (14.1 °C). The coldest year was 1888, with a mean temperature of 49.3 °F (9.6 °C). The driest month on record is June 1949, with 0.02 inches (0.51 mm) of rainfall. The wettest month was August 2011, with 18.95 inches (481 mm) of rainfall. The driest year on record is 1965, with 26.09 inches (663 mm) of rainfall. The wettest year was 1983, with 80.56 inches (2,046 mm) of rainfall. The snowiest month on record is February 2010, with 36.9 inches (94 cm) of snowfall. The snowiest season (Jul–Jun) on record is 1995–1996, with 75.6 inches (192 cm) of snowfall. The least snowy season was 1972–1973, with 2.3 inches (5.8 cm) of snowfall.\n\nSee or edit raw graph data.\n\n\n=== Parks ===\n\nThe City of New York has a complex park system, with various lands operated by the National Park Service, the New York State Office of Parks, Recreation and Historic Preservation, and the New York City Department of Parks and Recreation.\nIn its 2018 ParkScore ranking, The Trust for Public Land reported that the park system in New York City was the ninth-best park system among the fifty most populous U.S. cities. ParkScore ranks urban park systems by a formula that analyzes median park size, park acres as percent of city area, the percent of city residents within a half-mile of a park, spending of park services per resident, and the number of playgrounds per 10,000 residents.\n\n\n==== National parks ====\n\nGateway National Recreation Area contains over 26,000 acres (10,521.83 ha) in total, most of it surrounded by New York City, including the Jamaica Bay Wildlife Refuge. In Brooklyn and Queens, the park contains over 9,000 acres (36 km2) of salt marsh, wetlands, islands, and water, including most of Jamaica Bay. Also in Queens, the park includes a significant portion of the western Rockaway Peninsula, most notably Jacob Riis Park and Fort Tilden. In Staten Island, Gateway National Recreation Area includes Fort Wadsworth, with historic pre-Civil War era Battery Weed and Fort Tompkins, and Great Kills Park, with beaches, trails, and a marina.\nThe Statue of Liberty National Monument and Ellis Island Immigration Museum are managed by the National Park Service and are in both the states of New York and New Jersey. They are joined in the harbor by Governors Island National Monument, in New York. Historic sites under federal management on Manhattan Island include Castle Clinton National Monument; Federal Hall National Memorial; Theodore Roosevelt Birthplace National Historic Site; General Grant National Memorial ("Grant\'s Tomb"); African Burial Ground National Monument; and Hamilton Grange National Memorial. Hundreds of private properties are listed on the National Register of Historic Places or as a National Historic Landmark such as, for example, the Stonewall Inn, part of the Stonewall National Monument in Greenwich Village, as the catalyst of the modern gay rights movement.\n\n\n==== State parks ====\n\nThere are seven state parks within the confines of New York City, including Clay Pit Ponds State Park Preserve, a natural area that includes extensive riding trails, and Riverbank State Park, a 28-acre (11 ha) facility that rises 69 feet (21 m) over the Hudson River.\n\n\n==== City parks ====\n\nNew York City has over 28,000 acres (110 km2) of municipal parkland and 14 miles (23 km) of public beaches. The largest municipal park in the city is Pelham Bay Park in the Bronx, with 2,772 acres (1,122 ha).\nCentral Park, an 843-acre (3.41 km2) park in middle-upper Manhattan, is the most visited urban park in the United States and one of the most filmed locations in the world, with 40 million visitors in 2013. The park contains a wide range of attractions; there are several lakes and ponds, two ice-skating rinks, the Central Park Zoo, the Central Park Conservatory Garden, and the 106-acre (0.43 km2) Jackie Onassis Reservoir. Indoor attractions include Belvedere Castle with its nature center, the Swedish Cottage Marionette Theater, and the historic Carousel. On October 23, 2012, hedge fund manager John A. Paulson announced a $100 million gift to the Central Park Conservancy, the largest ever monetary donation to New York City\'s park system.\nWashington Square Park is a prominent landmark in the Greenwich Village neighborhood of Lower Manhattan. The Washington Square Arch at the northern gateway to the park is an iconic symbol of both New York University and Greenwich Village.\nProspect Park in Brooklyn has a 90-acre (36 ha) meadow, a lake, and extensive woodlands. Within the park is the historic Battle Pass, prominent in the Battle of Long Island.\nFlushing Meadows–Corona Park in Queens, with its 897 acres (363 ha) making it the city\'s fourth largest park, was the setting for the 1939 World\'s Fair and the 1964 World\'s Fair and is host to the USTA Billie Jean King National Tennis Center and the annual United States Open Tennis Championships tournament.\nOver a fifth of the Bronx\'s area, 7,000 acres (28 km2), is given over to open space and parks, including Pelham Bay Park, Van Cortlandt Park, the Bronx Zoo, and the New York Botanical Gardens.\nIn Staten Island, the Conference House Park contains the historic Conference House, site of the only attempt of a peaceful resolution to the American Revolution which was conducted in September 1775, attended by Benjamin Franklin representing the Americans and Lord Howe representing the British Crown. The historic Burial Ridge, the largest Native American burial ground within New York City, is within the park.\n\n\n=== Military installations ===\nNew York City is home to Fort Hamilton, the U.S. military\'s only active duty installation within the city. The Brooklyn facility was established in 1825 on the site of a small battery utilized during the American Revolution, and it is one of America\'s longest serving military forts. Today Fort Hamilton serves as the headquarters of the North Atlantic Division of the United States Army Corps of Engineers and for the New York City Recruiting Battalion. It also houses the 1179th Transportation Brigade, the 722nd Aeromedical Staging Squadron, and a military entrance processing station. Other formerly active military reservations still utilized for National Guard and military training or reserve operations in the city include Fort Wadsworth in Staten Island and Fort Totten in Queens.\n\n\n== Demographics ==\n\nNew York City is the most populous city in the United States, with an estimated 8,398,748 residents as of July 2018, incorporating more immigration into the city than outmigration since the 2010 United States Census. More than twice as many people live in New York City as compared to Los Angeles, the second-most populous U.S. city, and within a smaller area. New York City gained more residents between April 2010 and July 2014 (316,000) than any other U.S. city. New York City\'s population is about 43% of New York State\'s population and about 36% of the population of the New York metropolitan area.\n\n\n=== Population density ===\nIn 2017, the city had an estimated population density of 28,491 inhabitants per square mile (11,000/km2), rendering it the most densely populated of all municipalities housing over 100,000 residents in the United States, with several small cities (of fewer than 100,000) in adjacent Hudson County, New Jersey having greater density, as per the 2010 Census. Geographically co-extensive with New York County, the borough of Manhattan\'s 2017 population density of 72,918 inhabitants per square mile (28,154/km2) makes it the highest of any county in the United States and higher than the density of any individual American city.\n\n\n=== Race and ethnicity ===\n\nThe city\'s population in 2010 was 44% white (33.3% non-Hispanic white), 25.5% black (23% non-Hispanic black), 0.7% Native American, and 12.7% Asian. Hispanics of any race represented 28.6% of the population, while Asians constituted the fastest-growing segment of the city\'s population between 2000 and 2010; the non-Hispanic white population declined 3 percent, the smallest recorded decline in decades; and for the first time since the Civil War, the number of blacks declined over a decade.\nThroughout its history, New York has been a major port of entry for immigrants into the United States. More than 12 million European immigrants were received at Ellis Island between 1892 and 1924. The term "melting pot" was first coined to describe densely populated immigrant neighborhoods on the Lower East Side. By 1900, Germans constituted the largest immigrant group, followed by the Irish, Jews, and Italians. In 1940, whites represented 92% of the city\'s population.Approximately 37% of the city\'s population is foreign born, and more than half of all children are born to mothers who are immigrants. In New York, no single country or region of origin dominates. The ten largest sources of foreign-born individuals in the city as of 2011 were the Dominican Republic, China, Mexico, Guyana, Jamaica, Ecuador, Haiti, India, Russia, and Trinidad and Tobago, while the Bangladeshi-born immigrant population has become one of the fastest growing in the city, counting over 74,000 by 2011.\n\nAsian Americans in New York City, according to the 2010 Census, number more than one million, greater than the combined totals of San Francisco and Los Angeles. New York contains the highest total Asian population of any U.S. city proper. The New York City borough of Queens is home to the state\'s largest Asian American population and the largest Andean (Colombian, Ecuadorian, Peruvian, and Bolivian) populations in the United States, and is also the most ethnically diverse urban area in the world.The Chinese population constitutes the fastest-growing nationality in New York State; multiple satellites of the original Manhattan Chinatown, in Brooklyn, and around Flushing, Queens, are thriving as traditionally urban enclaves – while also expanding rapidly eastward into suburban Nassau County on Long Island, as the New York metropolitan region and New York State have become the top destinations for new Chinese immigrants, respectively, and large-scale Chinese immigration continues into New York City and surrounding areas, with the largest metropolitan Chinese diaspora outside Asia, including an estimated 812,410 individuals in 2015.In 2012, 6.3% of New York City was of Chinese ethnicity, with nearly three-fourths living in either Queens or Brooklyn, geographically on Long Island. A community numbering 20,000 Korean-Chinese (Chaoxianzu or Joseonjok) is centered in Flushing, Queens, while New York City is also home to the largest Tibetan population outside China, India, and Nepal, also centered in Queens. Koreans made up 1.2% of the city\'s population, and Japanese 0.3%. Filipinos were the largest Southeast Asian ethnic group at 0.8%, followed by Vietnamese, who made up 0.2% of New York City\'s population in 2010. Indians are the largest South Asian group, comprising 2.4% of the city\'s population, with Bangladeshis and Pakistanis at 0.7% and 0.5%, respectively. Queens is the preferred borough of settlement for Asian Indians, Koreans, Filipinos, and Malaysians and other Southeast Asians; while Brooklyn is receiving large numbers of both West Indian and Asian Indian immigrants.\n\nNew York City has the largest European and non-Hispanic white population of any American city. At 2.7 million in 2012, New York\'s non-Hispanic white population is larger than the non-Hispanic white populations of Los Angeles (1.1 million), Chicago (865,000), and Houston (550,000) combined. The non-Hispanic white population was 6.6 million in 1940. The non-Hispanic white population has begun to increase since 2010.The European diaspora residing in the city is very diverse. According to 2012 Census estimates, there were roughly 560,000 Italian Americans, 385,000 Irish Americans, 253,000 German Americans, 223,000 Russian Americans, 201,000 Polish Americans, and 137,000 English Americans. Additionally, Greek and French Americans numbered 65,000 each, with those of Hungarian descent estimated at 60,000 people. Ukrainian and Scottish Americans numbered 55,000 and 35,000, respectively. People identifying ancestry from Spain numbered 30,838 total in 2010.People of Norwegian and Swedish descent both stood at about 20,000 each, while people of Czech, Lithuanian, Portuguese, Scotch-Irish, and Welsh descent all numbered between 12,000–14,000 people. Arab Americans number over 160,000 in New York City, with the highest concentration in Brooklyn. Central Asians, primarily Uzbek Americans, are a rapidly growing segment of the city\'s non-Hispanic white population, enumerating over 30,000, and including over half of all Central Asian immigrants to the United States, most settling in Queens or Brooklyn. Albanian Americans are most highly concentrated in the Bronx.The wider New York City metropolitan statistical area, with over 20 million people, about 50% greater than the second-place Los Angeles metropolitan area in the United States, is also ethnically diverse, with the largest foreign-born population of any metropolitan region in the world. The New York region continues to be by far the leading metropolitan gateway for legal immigrants admitted into the United States, substantially exceeding the combined totals of Los Angeles and Miami. It is home to the largest Jewish and Israeli communities outside Israel, with the Jewish population in the region numbering over 1.5 million in 2012 and including many diverse Jewish sects, predominantly from around the Middle East and Eastern Europe, and including a rapidly growing Orthodox Jewish population, the largest outside Israel.The metropolitan area is also home to 20% of the USA\'s Indian Americans and at least 20 Little India enclaves, and 15% of all Korean Americans and four Koreatowns; the largest Asian Indian population in the Western Hemisphere; the largest Russian American, Italian American, and African American populations; the largest Dominican American, Puerto Rican American, and South American and second-largest overall Hispanic population in the United States, numbering 4.8 million; and includes multiple established Chinatowns within New York City alone.Ecuador, Colombia, Guyana, Peru, and Brazil were the top source countries from South America for legal immigrants to the New York City region in 2013; the Dominican Republic, Jamaica, Haiti, and Trinidad and Tobago in the Caribbean; Egypt, Ghana, and Nigeria from Africa; and El Salvador, Honduras, and Guatemala in Central America. Amidst a resurgence of Puerto Rican migration to New York City, this population had increased to approximately 1.3 million in the metropolitan area as of 2013.\nSince 2010, a Little Australia has emerged and is growing rapidly representing the Australasian presence in Nolita, Manhattan. In 2011, there were an estimated 20,000 Australian residents of New York City, nearly quadruple the 5,537 in 2005. Qantas Airways of Australia and Air New Zealand have been exploring the possibilities of long-haul flights from New York to Sydney and Auckland, respectively, which would both rank among the longest non-stop flights in the world. A Little Sri Lanka has developed in the Tompkinsville neighborhood of Staten Island.\n\n\n=== Sexual orientation and gender identity ===\n\nThe New York metropolitan area is home to a prominent self-identifying gay and bisexual community estimated at nearly 570,000 individuals, the largest in the United States and one of the world\'s largest. Same-sex marriages in New York were legalized on June 24, 2011 and were authorized to take place beginning 30 days thereafter. Charles Kaiser, author of The Gay Metropolis: The Landmark History of Gay Life in America, wrote that in the era after World War II, "New York City became the literal gay metropolis for hundreds of thousands of immigrants from within and without the United States: the place they chose to learn how to live openly, honestly and without shame."The annual New York City Pride March (or gay pride parade) traverses southward down Fifth Avenue and ends at Greenwich Village in Lower Manhattan; the parade rivals the Sao Paulo Gay Pride Parade as the largest pride parade in the world, attracting tens of thousands of participants and millions of sidewalk spectators each June. The annual Queens Pride Parade is held in Jackson Heights and is accompanied by the ensuing Multicultural Parade. Stonewall 50 – WorldPride NYC 2019 was the largest international Pride celebration in history, produced by Heritage of Pride and enhanced through a partnership with the I ❤ NY program\'s LGBT division, commemorating the 50th anniversary of the Stonewall uprising, with 150,000 participants and five million spectators attending in Manhattan alone. New York City is also home to the largest transgender population in the world, estimated at more than 50,000 in 2018, concentrated in Manhattan and Queens; however, until the June 1969 Stonewall riots, this community had felt marginalized and neglected by the gay community.\n\n\n=== Religion ===\nChristianity (59%) — made up of Roman Catholicism (33%), Protestantism (23%), and other Christians (3%) — is the most prevalent religion in New York, as of 2014. It is followed by Judaism, with approximately 1.1 million adherents, over half of whom live in Brooklyn. The Jewish population makes up 18.4% of the city. Islam ranks third in New York City, with estimates ranging between 600,000 and 1,000,000 observers, including 10% of the city\'s public school children. These three largest groups are followed by Hinduism, Buddhism, and a variety of other religions, as well as atheism. In 2014, 24% of New Yorkers self-identified with no organized religious affiliation.\n\n\n=== Wealth and income disparity ===\nNew York City has a high degree of income disparity as indicated by its Gini Coefficient of 0.5 for the city overall and 0.6 for Manhattan, as of 2006. (This is not unusual, as all large cities have greater income disparities than the nation overall.) In the first quarter of 2014, the average weekly wage in New York County (Manhattan) was $2,749, representing the highest total among large counties in the United States. As of 2017, New York City was home to the highest number of billionaires of any city in the world at 103, including former Mayor Michael Bloomberg. New York also had the highest density of millionaires per capita among major U.S. cities in 2014, at 4.6% of residents. New York City is one of the relatively few American cities levying an income tax (currently about 3%) on its residents. As of 2018, there were 78,676 homeless people in New York City.\n\n\n== Economy ==\n\n\n=== City economic overview ===\nNew York City is a global hub of business and commerce, as a center for banking and finance, retailing, world trade, transportation, tourism, real estate, new media, traditional media, advertising, legal services, accountancy, insurance, theater, fashion, and the arts in the United States; while Silicon Alley, metonymous for New York\'s broad-spectrum high technology sphere, continues to expand. The Port of New York and New Jersey is also a major economic engine, handling record cargo volume in 2017, over 6.7 million TEUs. New York City\'s unemployment rate fell to its record low of 4.0% in September 2018.Many Fortune 500 corporations are headquartered in New York City, as are a large number of multinational corporations. One out of ten private sector jobs in the city is with a foreign company. New York City has been ranked first among cities across the globe in attracting capital, business, and tourists. New York City\'s role as the top global center for the advertising industry is metonymously reflected as "Madison Avenue". The city\'s fashion industry provides approximately 180,000 employees with $11 billion in annual wages.Other important sectors include medical research and technology, non-profit institutions, and universities. Manufacturing accounts for a significant but declining share of employment, although the city\'s garment industry is showing a resurgence in Brooklyn. Food processing is a US$5 billion industry that employs more than 19,000 residents.\nChocolate is New York City\'s leading specialty-food export, with up to US$234 million worth of exports each year. Entrepreneurs were forming a "Chocolate District" in Brooklyn as of 2014, while Godiva, one of the world\'s largest chocolatiers, continues to be headquartered in Manhattan.\n\n\n=== Wall Street ===\n\nNew York City\'s most important economic sector lies in its role as the headquarters for the U.S. financial industry, metonymously known as Wall Street. The city\'s securities industry, enumerating 163,400 jobs in August 2013, continues to form the largest segment of the city\'s financial sector and an important economic engine, accounting in 2012 for 5 percent of the city\'s private sector jobs, 8.5 percent (US$3.8 billion) of its tax revenue, and 22 percent of the city\'s total wages, including an average salary of US$360,700. Many large financial companies are headquartered in New York City, and the city is also home to a burgeoning number of financial startup companies.\nLower Manhattan is home to the New York Stock Exchange, on Wall Street, and the NASDAQ, at 165 Broadway, representing the world\'s largest and second largest stock exchanges, respectively, when measured both by overall average daily trading volume and by total market capitalization of their listed companies in 2013. Investment banking fees on Wall Street totaled approximately $40 billion in 2012, while in 2013, senior New York City bank officers who manage risk and compliance functions earned as much as $324,000 annually. In fiscal year 2013–14, Wall Street\'s securities industry generated 19% of New York State\'s tax revenue.New York City remains the largest global center for trading in public equity and debt capital markets, driven in part by the size and financial development of the U.S. economy. New York also leads in hedge fund management; private equity; and the monetary volume of mergers and acquisitions. Several investment banks and investment managers headquartered in Manhattan are important participants in other global financial centers. New York is also the principal commercial banking center of the United States.Many of the world\'s largest media conglomerates are also based in the city. Manhattan contained over 500 million square feet (46.5 million m2) of office space in 2018, making it the largest office market in the United States, while Midtown Manhattan, with 400 million square feet (37.2 million m2) in 2018, is the largest central business district in the world.\n\n\n=== Tech and biotech ===\n\nSilicon Alley, centered in Manhattan, has evolved into a metonym for the sphere encompassing the New York City metropolitan region\'s high technology industries involving the Internet, new media, telecommunications, digital media, software development, game design, financial technology ("FinTech"), and other fields within information technology that are supported by its entrepreneurship ecosystem and venture capital investments. In 2015, Silicon Alley generated over US$7.3 billion in venture capital investment across a broad spectrum of high technology enterprises, most based in Manhattan, with others in Brooklyn, Queens, and elsewhere in the region.\nHigh technology startup companies and employment are growing in New York City and the region, bolstered by the city\'s position in North America as the leading Internet hub and telecommunications center, including its vicinity to several transatlantic fiber optic trunk lines, New York\'s intellectual capital, and its extensive outdoor wireless connectivity. Verizon Communications, headquartered at 140 West Street in Lower Manhattan, was at the final stages in 2014 of completing a US$3 billion fiberoptic telecommunications upgrade throughout New York City. As of 2014, New York City hosted 300,000 employees in the tech sector. The technology sector has been claiming a greater share of New York City\'s economy since 2010. Tech:NYC, founded in 2016, is a non-profit organization which represents New York City\'s technology industry with government, civic institutions, in business, and in the media, and whose primary goals are to further augment New York\'s substantial tech talent base and to advocate for policies that will nurture tech companies to grow in the city.The biotechnology sector is also growing in New York City, based upon the city\'s strength in academic scientific research and public and commercial financial support. On December 19, 2011, then Mayor Michael R. Bloomberg announced his choice of Cornell University and Technion-Israel Institute of Technology to build a US$2 billion graduate school of applied sciences called Cornell Tech on Roosevelt Island with the goal of transforming New York City into the world\'s premier technology capital. By mid-2014, Accelerator, a biotech investment firm, had raised more than US$30 million from investors, including Eli Lilly and Company, Pfizer, and Johnson & Johnson, for initial funding to create biotechnology startups at the Alexandria Center for Life Science, which encompasses more than 700,000 square feet (65,000 m2) on East 29th Street and promotes collaboration among scientists and entrepreneurs at the center and with nearby academic, medical, and research institutions. The New York City Economic Development Corporation\'s Early Stage Life Sciences Funding Initiative and venture capital partners, including Celgene, General Electric Ventures, and Eli Lilly, committed a minimum of US$100 million to help launch 15 to 20 ventures in life sciences and biotechnology.\n\n\n=== Real estate ===\n\nReal estate is a major force in the city\'s economy, as the total value of all New York City property was assessed at US$1.072 trillion for the 2017 fiscal year, an increase of 10.6% from the previous year, with 89% of the increase coming from market effects. The Time Warner Center is the property with the highest-listed market value in the city, at US$1.1 billion in 2006. New York City is home to some of the nation\'s—and the world\'s—most valuable real estate. 450 Park Avenue was sold on July 2, 2007 for US$510 million, about $1,589 per square foot ($17,104/m²), breaking the barely month-old record for an American office building of $1,476 per square foot ($15,887/m²) set in the June 2007 sale of 660 Madison Avenue.In 2014 Manhattan was home to six of the top ten ZIP Codes in the United States by median housing price. Fifth Avenue in Midtown Manhattan commands the highest retail rents in the world, at US$3,000 per square foot ($32,000/m2) in 2017. In 2019, the most expensive home sale ever in the United States achieved completion in Manhattan, at a selling price of US$238 million, for a 24,000 square feet (2,200 m2) penthouse apartment overlooking Central Park.\n\n\n=== Tourism ===\n\nTourism is a vital industry for New York City, which has witnessed a growing combined volume of international and domestic tourists, receiving an eighth consecutive annual record of approximately 62.8 million visitors in 2017. Tourism had generated an all-time high US$61.3 billion in overall economic impact for New York City in 2014, pending 2015 statistics. Approximately 12 million visitors to New York City were from outside the United States, with the highest numbers from the United Kingdom, Canada, Brazil, and China.\nI Love New York (stylized I ❤ NY) is both a logo and a song that are the basis of an advertising campaign and have been used since 1977 to promote tourism in New York City, and later to promote New York State as well. The trademarked logo, owned by New York State Empire State Development, appears in souvenir shops and brochures throughout the city and state, some licensed, many not. The song is the state song of New York.\nMajor tourist destinations include Times Square; Broadway theater productions; the Empire State Building; the Statue of Liberty; Ellis Island; the United Nations Headquarters; museums such as the Metropolitan Museum of Art; greenspaces such as Central Park and Washington Square Park; Rockefeller Center; the Manhattan Chinatown; luxury shopping along Fifth and Madison Avenues; and events such as the Halloween Parade in Greenwich Village; the Macy\'s Thanksgiving Day Parade; the lighting of the Rockefeller Center Christmas Tree; the St. Patrick\'s Day parade; seasonal activities such as ice skating in Central Park in the wintertime; the Tribeca Film Festival; and free performances in Central Park at Summerstage. Major attractions in the boroughs outside Manhattan include Flushing Meadows-Corona Park and the Unisphere in Queens; the Bronx Zoo; Coney Island, Brooklyn; and the New York Botanical Garden in the Bronx. The New York Wheel, a 630-foot ferris wheel, was under construction at the northern shore of Staten Island in 2015, overlooking the Statue of Liberty, New York Harbor, and the Lower Manhattan skyline.Manhattan was on track to have an estimated 90,000 hotel rooms at the end of 2014, a 10% increase from 2013. In October 2014, the Anbang Insurance Group, based in China, purchased the Waldorf Astoria New York for US$1.95 billion, making it the world\'s most expensive hotel ever sold.\n\n\n=== Media and entertainment ===\n\nNew York is a prominent location for the American entertainment industry, with many films, television series, books, and other media being set there. As of 2012, New York City was the second largest center for filmmaking and television production in the United States, producing about 200 feature films annually, employing 130,000 individuals. The filmed entertainment industry has been growing in New York, contributing nearly US$9 billion to the New York City economy alone as of 2015. By volume, New York is the world leader in independent film production – one-third of all American independent films are produced in New York City. The Association of Independent Commercial Producers is also based in New York. In the first five months of 2014 alone, location filming for television pilots in New York City exceeded the record production levels for all of 2013, with New York surpassing Los Angeles as the top North American city for the same distinction during the 2013–2014 cycle.New York City is also a center for the advertising, music, newspaper, digital media, and publishing industries and is also the largest media market in North America. Some of the city\'s media conglomerates and institutions include Time Warner, the Thomson Reuters Corporation, the Associated Press, Bloomberg L.P., the News Corporation, The New York Times Company, NBCUniversal, the Hearst Corporation, AOL, and Viacom. Seven of the world\'s top eight global advertising agency networks have their headquarters in New York. Two of the top three record labels\' headquarters are in New York: Sony Music Entertainment and Warner Music Group. Universal Music Group also has offices in New York. New media enterprises are contributing an increasingly important component to the city\'s central role in the media sphere.\nMore than 200 newspapers and 350 consumer magazines have an office in the city, and the publishing industry employs about 25,000 people. Two of the three national daily newspapers with the largest circulations in the United States are published in New York: The Wall Street Journal and The New York Times, which has won the most Pulitzer Prizes for journalism. Major tabloid newspapers in the city include The New York Daily News, which was founded in 1919 by Joseph Medill Patterson, and The New York Post, founded in 1801 by Alexander Hamilton. The city also has a comprehensive ethnic press, with 270 newspapers and magazines published in more than 40 languages. El Diario La Prensa is New York\'s largest Spanish-language daily and the oldest in the nation. The New York Amsterdam News, published in Harlem, is a prominent African American newspaper. The Village Voice, historically the largest alternative newspaper in the United States, announced in 2017 that it would cease publication of its print edition and convert to a fully digital venture.The television and radio industry developed in New York and is a significant employer in the city\'s economy. The three major American broadcast networks are all headquartered in New York: ABC, CBS, and NBC. Many cable networks are based in the city as well, including MTV, Fox News, HBO, Showtime, Bravo, Food Network, AMC, and Comedy Central. The City of New York operates a public broadcast service, NYC Media, that has produced several original Emmy Award-winning shows covering music and culture in city neighborhoods and city government. WBAI, with news and information programming, is one of the few socialist radio stations operating in the United States.\nNew York is also a major center for non-commercial educational media. The oldest public-access television channel in the United States is the Manhattan Neighborhood Network, founded in 1971. WNET is the city\'s major public television station and a primary source of national Public Broadcasting Service (PBS) television programming. WNYC, a public radio station owned by the city until 1997, has the largest public radio audience in the United States.\n\n\n== Education and scholarly activity ==\n\n\n=== Primary and secondary education ===\nThe New York City Public Schools system, managed by the New York City Department of Education, is the largest public school system in the United States, serving about 1.1 million students in more than 1,700 separate primary and secondary schools. The city\'s public school system includes nine specialized high schools to serve academically and artistically gifted students. The city government pays the Pelham Public Schools to educate a very small, detached section of the Bronx.\n\nThe New York City Charter School Center assists the setup of new charter schools. There are approximately 900 additional privately run secular and religious schools in the city.\n\n\n=== Higher education and research ===\nOver 600,000 students are enrolled in New York City\'s over 120 higher education institutions, the highest number of any city in the United States and higher than other major global cities like London and Tokyo, including over half million in the City University of New York (CUNY) system alone in 2014. New York City\'s higher education institutions had also higher average scores than those two cities in 2019, according to the Academic Ranking of World Universities. New York City is home to such notable private universities as Barnard College, Columbia University, Cooper Union, Fordham University, New York University, New York Institute of Technology, Rockefeller University, and Yeshiva University; several of these universities are ranked among the top universities in the world.The public CUNY system is one of the largest universities in the nation, comprising 24 institutions across all five boroughs: senior colleges, community colleges, and other graduate/professional schools. The public State University of New York (SUNY) system includes campuses in New York City, including: Downstate Health Sciences University, Fashion Institute of Technology, Maritime College, and the College of Optometry. The city also hosts other smaller private colleges and universities, including many religious and special-purpose institutions, such as: St. John\'s University, The Juilliard School, Manhattan College, The College of Mount Saint Vincent, Parsons School of Design, The New School, Pratt Institute, New York Film Academy, The School of Visual Arts, The King\'s College, and Wagner College.\nMuch of the scientific research in the city is done in medicine and the life sciences. New York City has the most postgraduate life sciences degrees awarded annually in the United States, with 127 Nobel laureates having roots in local institutions as of 2005; while in 2012, 43,523 licensed physicians were practicing in New York City. Major biomedical research institutions include Memorial Sloan–Kettering Cancer Center, Rockefeller University, SUNY Downstate Medical Center, Albert Einstein College of Medicine, Mount Sinai School of Medicine, and Weill Cornell Medical College, being joined by the Cornell University/Technion-Israel Institute of Technology venture on Roosevelt Island. The graduates of SUNY Maritime College in the Bronx earned the highest average annual salary of any university graduates in the United States, US$144,000 as of 2017.\n\n\n== Human resources ==\n\n\n=== Public health ===\n\nThe New York City Health and Hospitals Corporation (HHC) operates the public hospitals and clinics in New York City. A public benefit corporation with $6.7 billion in annual revenues, HHC is the largest municipal healthcare system in the United States serving 1.4 million patients, including more than 475,000 uninsured city residents. HHC was created in 1969 by the New York State Legislature as a public benefit corporation (Chapter 1016 of the Laws 1969). HHC operates 11 acute care hospitals, five nursing homes, six diagnostic and treatment centers, and more than 70 community-based primary care sites, serving primarily the poor and working class. HHC\'s MetroPlus Health Plan is one of the New York area\'s largest providers of government-sponsored health insurance and is the plan of choice for nearly half million New Yorkers.HHC\'s facilities annually provide millions of New Yorkers services interpreted in more than 190 languages. The most well-known hospital in the HHC system is Bellevue Hospital, the oldest public hospital in the United States. Bellevue is the designated hospital for treatment of the President of the United States and other world leaders if they become sick or injured while in New York City. The president of HHC is Ramanathan Raju, MD, a surgeon and former CEO of the Cook County health system in Illinois. In August 2017, Mayor Bill de Blasio signed legislation outlawing pharmacies from selling cigarettes once their existing licenses to do so expired, beginning in 2018.\n\n\n=== Public safety ===\n\n\n==== Police and law enforcement ====\n\nThe New York Police Department (NYPD) has been the largest police force in the United States by a significant margin, with over 35,000 sworn officers. Members of the NYPD are frequently referred to by politicians, the media, and their own police cars by the nickname, New York\'s Finest.\nCrime has continued an overall downward trend in New York City since the 1990s. In 2012, the NYPD came under scrutiny for its use of a stop-and-frisk program, which has undergone several policy revisions since then. In 2014, New York City had the third lowest murder rate among the largest U.S. cities, having become significantly safer after a spike in crime in the 1970s through 1990s. Violent crime in New York City decreased more than 75% from 1993 to 2005, and continued decreasing during periods when the nation as a whole saw increases. By 2002, New York City\'s crime rate was similar to that of Provo, Utah, and was ranked 197th in crime among the 216 U.S. cities with populations greater than 100,000. In 1992, the city recorded 2,245 murders. In 2005, the homicide rate was at its lowest level since 1966, and in 2009, the city recorded fewer than 461 homicides for the first time ever since crime statistics were first published in 1963. In 2017, 60.1% of violent crime suspects were Black, 29.6% Hispanic, 6.5% White, 3.6% Asian and 0.2% American Indian. New York City experienced 292 homicides in 2017,Sociologists and criminologists have not reached consensus on the explanation for the dramatic decrease in the city\'s crime rate. Some attribute the phenomenon to new tactics used by the NYPD, including its use of CompStat and the broken windows theory. Others cite the end of the crack epidemic and demographic changes, including from immigration. Another theory is that widespread exposure to lead pollution from automobile exhaust, which can lower intelligence and increase aggression levels, incited the initial crime wave in the mid-20th century, most acutely affecting heavily trafficked cities like New York. A strong correlation was found demonstrating that violent crime rates in New York and other big cities began to fall after lead was removed from American gasoline in the 1970s. Another theory cited to explain New York City\'s falling homicide rate is the inverse correlation between the number of murders and the increasingly wetter climate in the city.Organized crime has long been associated with New York City, beginning with the Forty Thieves and the Roach Guards in the Five Points in the 1820s. The 20th century saw a rise in the Mafia, dominated by the Five Families, as well as in gangs, including the Black Spades. The Mafia and gang presence has declined in the city in the 21st century.\n\n\n==== Firefighting ====\n\nThe Fire Department of New York (FDNY), provides fire protection, technical rescue, primary response to biological, chemical, and radioactive hazards, and emergency medical services for the five boroughs of New York City. The FDNY is the largest municipal fire department in the United States and the second largest in the world after the Tokyo Fire Department. The FDNY employs approximately 11,080 uniformed firefighters and over 3,300 uniformed EMTs and paramedics. The FDNY\'s motto is New York\'s Bravest.\nThe fire department faces multifaceted firefighting challenges in many ways unique to New York. In addition to responding to building types that range from wood-frame single family homes to high-rise structures, there are many secluded bridges and tunnels, as well as large parks and wooded areas that can give rise to brush fires. New York is also home to one of the largest subway systems in the world, consisting of hundreds of miles of tunnel with electrified track.\nThe FDNY headquarters is located at 9 MetroTech Center in Downtown Brooklyn, and the FDNY Fire Academy is located on Randalls Island. There are three Bureau of Fire Communications alarm offices which receive and dispatch alarms to appropriate units. One office, at 11 Metrotech Center in Brooklyn, houses Manhattan/Citywide, Brooklyn, and Staten Island Fire Communications; the Bronx and Queens offices are in separate buildings.\n\n\n=== Public library system ===\n\nThe New York Public Library, which has the largest collection of any public library system in the United States, serves Manhattan, the Bronx, and Staten Island. Queens is served by the Queens Borough Public Library, the nation\'s second largest public library system, while the Brooklyn Public Library serves Brooklyn.\n\n\n== Culture and contemporary life ==\n\nNew York City has been described as the cultural capital of the world by the diplomatic consulates of Iceland and Latvia and by New York\'s Baruch College. A book containing a series of essays titled New York, Culture Capital of the World, 1940–1965 has also been published as showcased by the National Library of Australia. In describing New York, author Tom Wolfe said, "Culture just seems to be in the air, like part of the weather."Numerous major American cultural movements began in the city, such as the Harlem Renaissance, which established the African-American literary canon in the United States. The city was a center of jazz in the 1940s, abstract expressionism in the 1950s, and the birthplace of hip hop in the 1970s. The city\'s punk and hardcore scenes were influential in the 1970s and 1980s. New York has long had a flourishing scene for Jewish American literature.\nThe city is the birthplace of many cultural movements, including the Harlem Renaissance in literature and visual art; abstract expressionism (also known as the New York School) in painting; and hip hop, punk, salsa, freestyle, Tin Pan Alley, certain forms of jazz, and (along with Philadelphia) disco in music. New York City has been considered the dance capital of the world. The city is also frequently the setting for novels, movies (see List of films set in New York City), and television programs. New York Fashion Week is one of the world\'s preeminent fashion events and is afforded extensive coverage by the media.\nNew York has also frequently been ranked the top fashion capital of the world on the annual list compiled by the Global Language Monitor.\n\n\n=== Pace ===\nOne of the most common traits attributed to New York City is its fast pace, which spawned the term New York minute. Journalist Walt Whitman characterized New York\'s streets as being traversed by "hurrying, feverish, electric crowds".\n\n\n=== Arts ===\nNew York City has more than 2,000 arts and cultural organizations and more than 500 art galleries of all sizes. The city government funds the arts with a larger annual budget than the National Endowment for the Arts. Wealthy business magnates in the 19th century built a network of major cultural institutions, such as the famed Carnegie Hall and the Metropolitan Museum of Art, that would become internationally established. The advent of electric lighting led to elaborate theater productions, and in the 1880s, New York City theaters on Broadway and along 42nd Street began featuring a new stage form that became known as the Broadway musical. Strongly influenced by the city\'s immigrants, productions such as those of Harrigan and Hart, George M. Cohan, and others used song in narratives that often reflected themes of hope and ambition. New York City itself is the subject or background of many plays and musicals.\n\n\n==== Performing arts ====\n\nBroadway theatre is one of the premier forms of English-language theatre in the world, named after Broadway, the major thoroughfare that crosses Times Square, also sometimes referred to as "The Great White Way". Forty-one venues in Midtown Manhattan\'s Theatre District, each with at least 500 seats, are classified as Broadway theatres. According to The Broadway League, Broadway shows sold approximately US$1.27 billion worth of tickets in the 2013–2014 season, an 11.4% increase from US$1.139 billion in the 2012–2013 season. Attendance in 2013–2014 stood at 12.21 million, representing a 5.5% increase from the 2012–2013 season\'s 11.57 million. Performance artists displaying diverse skills are ubiquitous on the streets of Manhattan.\nLincoln Center for the Performing Arts, anchoring Lincoln Square on the Upper West Side of Manhattan, is home to numerous influential arts organizations, including the Metropolitan Opera, New York City Opera, New York Philharmonic, and New York City Ballet, as well as the Vivian Beaumont Theater, the Juilliard School, Jazz at Lincoln Center, and Alice Tully Hall. The Lee Strasberg Theatre and Film Institute is in Union Square, and Tisch School of the Arts is based at New York University, while Central Park SummerStage presents free music concerts in Central Park.\n\n\n==== Visual arts ====\n\nNew York City is home to hundreds of cultural institutions and historic sites, many of which are internationally known. Museum Mile is the name for a section of Fifth Avenue running from 82nd to 105th streets on the Upper East Side of Manhattan, in an area sometimes called Upper Carnegie Hill. The Mile, which contains one of the densest displays of culture in the world, is actually three blocks longer than one mile (1.6 km). Ten museums occupy the length of this section of Fifth Avenue. The tenth museum, the Museum for African Art, joined the ensemble in 2009, although its museum at 110th Street, the first new museum constructed on the Mile since the Guggenheim in 1959, opened in late 2012. In addition to other programming, the museums collaborate for the annual Museum Mile Festival, held each year in June, to promote the museums and increase visitation. Many of the world\'s most lucrative art auctions are held in New York City.\n\n\n=== Cuisine ===\n\nNew York City\'s food culture includes an array of international cuisines influenced by the city\'s immigrant history. Central and Eastern European immigrants, especially Jewish immigrants from those regions, brought bagels, cheesecake, hot dogs, knishes, and delicatessens (or delis) to the city. Italian immigrants brought New York-style pizza and Italian cuisine into the city, while Jewish immigrants and Irish immigrants brought pastrami and corned beef, respectively. Chinese and other Asian restaurants, sandwich joints, trattorias, diners, and coffeehouses are ubiquitous throughout the city. Some 4,000 mobile food vendors licensed by the city, many immigrant-owned, have made Middle Eastern foods such as falafel and kebabs examples of modern New York street food. The city is home to "nearly one thousand of the finest and most diverse haute cuisine restaurants in the world", according to Michelin. The New York City Department of Health and Mental Hygiene assigns letter grades to the city\'s restaurants based upon their inspection results. As of 2019, there were 27,043 restaurants in the city, up from 24,865 in 2017. The Queens Night Market in Flushing Meadows–Corona Park attracts over 10,000 people nightly to sample food from over 85 countries.\n\n\n=== Parades ===\n\nNew York City is well known for its street parades, which celebrate a broad array of themes, including holidays, nationalities, human rights, and major league sports team championship victories. The majority of parades are held in Manhattan. The primary orientation of the annual street parades is typically from north to south, marching along major avenues. The annual Macy\'s Thanksgiving Day Parade is the world\'s largest parade, beginning alongside Central Park and processing southward to the flagship Macy\'s Herald Square store; the parade is viewed on telecasts worldwide and draws millions of spectators in person. Other notable parades including the annual St. Patrick\'s Day Parade in March, the LGBT Pride March in June, the Greenwich Village Halloween Parade in October, and numerous parades commemorating the independence days of many nations. Ticker-tape parades celebrating championships won by sports teams as well as other heroic accomplishments march northward along the Canyon of Heroes on Broadway from Bowling Green to City Hall Park in Lower Manhattan.\n\n\n=== Accent and dialect ===\n\nThe New York area is home to a distinctive regional speech pattern called the New York dialect, alternatively known as Brooklynese or New Yorkese. It has generally been considered one of the most recognizable accents within American English.The traditional New York area accent is characterized as non-rhotic, so that the sound [ɹ] does not appear at the end of a syllable or immediately before a consonant; therefore the pronunciation of the city name as "New Yawk." There is no [ɹ] in words like park [pɑək] or [pɒək] (with vowel backed and diphthongized due to the low-back chain shift), butter [bʌɾə], or here [hiə]. In another feature called the low back chain shift, the [ɔ] vowel sound of words like talk, law, cross, chocolate, and coffee and the often homophonous [ɔr] in core and more are tensed and usually raised more than in General American English. In the most old-fashioned and extreme versions of the New York dialect, the vowel sounds of words like "girl" and of words like "oil" became a diphthong [ɜɪ]. This is often misperceived by speakers of other accents as a reversal of the er and oy sounds, so that girl is pronounced "goil" and oil is pronounced "erl"; this leads to the caricature of New Yorkers saying things like "Joizey" (Jersey), "Toidy-Toid Street" (33rd St.) and "terlet" (toilet). The character Archie Bunker from the 1970s television sitcom All in the Family was an example of having used this pattern of speech.\nThe classic version of the New York City dialect is generally centered on middle and working-class New Yorkers. The influx of non-European immigrants in recent decades has led to changes in this distinctive dialect, and the traditional form of this speech pattern is no longer as prevalent among general New Yorkers as it has been in the past.\n\n\n=== Sports ===\n\nNew York City is home to the headquarters of the National Football League, Major League Baseball, the National Basketball Association, the National Hockey League, and Major League Soccer. The New York metropolitan area hosts the most sports teams in the four major North American professional sports leagues with nine, one more than Los Angeles, and has 11 top-level professional sports teams if Major League Soccer is included, also one more than Los Angeles. Participation in professional sports in the city predates all professional leagues, and the city has been continuously hosting professional sports since the birth of the Brooklyn Dodgers in 1882. The city has played host to over forty major professional teams in the five sports and their respective competing leagues, both current and historic. Four of the ten most expensive stadiums ever built worldwide (MetLife Stadium, the new Yankee Stadium, Madison Square Garden, and Citi Field) are located in the New York metropolitan area. Madison Square Garden, its predecessor, the original Yankee Stadium and Ebbets Field, are sporting venues located in New York City, the latter two having been commemorated on U.S. postage stamps.\nNew York has been described as the "Capital of Baseball". There have been 35 Major League Baseball World Series and 73 pennants won by New York teams. It is one of only five metro areas (Los Angeles, Chicago, Baltimore–Washington, and the San Francisco Bay Area being the others) to have two baseball teams. Additionally, there have been 14 World Series in which two New York City teams played each other, known as a Subway Series and occurring most recently in 2000. No other metropolitan area has had this happen more than once (Chicago in 1906, St. Louis in 1944, and the San Francisco Bay Area in 1989). The city\'s two current Major League Baseball teams are the New York Mets, who play at Citi Field in Queens, and the New York Yankees, who play at Yankee Stadium in the Bronx. These teams compete in six games of interleague play every regular season that has also come to be called the Subway Series. The Yankees have won a record 27 championships, while the Mets have won the World Series twice. The city also was once home to the Brooklyn Dodgers (now the Los Angeles Dodgers), who won the World Series once, and the New York Giants (now the San Francisco Giants), who won the World Series five times. Both teams moved to California in 1958. There are also two Minor League Baseball teams in the city, the Brooklyn Cyclones and Staten Island Yankees.The city is represented in the National Football League by the New York Giants and the New York Jets, although both teams play their home games at MetLife Stadium in nearby East Rutherford, New Jersey, which hosted Super Bowl XLVIII in 2014.The metropolitan area is home to three National Hockey League teams. The New York Rangers, the traditional representative of the city itself and one of the league\'s Original Six, play at Madison Square Garden in Manhattan. The New York Islanders, traditionally representing Nassau and Suffolk Counties of Long Island, currently play at Barclays Center in Brooklyn and are planning a return to Nassau County by way of a new arena just outside the border with Queens at Belmont Park. The New Jersey Devils play at Prudential Center in nearby Newark, New Jersey and traditionally represent the counties of neighboring New Jersey which are coextensive with the boundaries of the New York metropolitan area and media market.\nThe city\'s National Basketball Association teams are the Brooklyn Nets, which played in and were named for New Jersey until 2012, and the New York Knicks, while the New York Liberty is the city\'s Women\'s National Basketball Association team. The first national college-level basketball championship, the National Invitation Tournament, was held in New York in 1938 and remains in the city. The city is well known for its links to basketball, which is played in nearly every park in the city by local youth, many of whom have gone on to play for major college programs and in the NBA.\nIn soccer, New York City is represented by New York City FC of Major League Soccer, who play their home games at Yankee Stadium and the New York Red Bulls, who play their home games at Red Bull Arena in nearby Harrison, New Jersey. Historically, the city is known for the New York Cosmos, the highly successful former professional soccer team which was the American home of Pelé. A new version of the New York Cosmos was formed in 2010, and began play in the second division North American Soccer League in 2013. The Cosmos play their home games at James M. Shuart Stadium on the campus of Hofstra University, just outside the New York City limits in Hempstead, New York.\nThe annual United States Open Tennis Championships is one of the world\'s four Grand Slam tennis tournaments and is held at the National Tennis Center in Flushing Meadows-Corona Park, Queens. The New York City Marathon, which courses through all five boroughs, is the world\'s largest running marathon, with 51,394 finishers in 2016 and 98,247 applicants for the 2017 race. The Millrose Games is an annual track and field meet whose featured event is the Wanamaker Mile. Boxing is also a prominent part of the city\'s sporting scene, with events like the Amateur Boxing Golden Gloves being held at Madison Square Garden each year. The city is also considered the host of the Belmont Stakes, the last, longest and oldest of horse racing\'s Triple Crown races, held just over the city\'s border at Belmont Park on the first or second Sunday of June. The city also hosted the 1932 U.S. Open golf tournament and the 1930 and 1939 PGA Championships, and has been host city for both events several times, most notably for nearby Winged Foot Golf Club. The Gaelic games are played in Riverdale, Bronx at Gaelic Park, home to the New York GAA, the only North American team to compete at the senior inter-county level.\n\n\n== Transportation ==\n\nNew York City\'s comprehensive transportation system is both complex and extensive.\n\n\n=== Rapid transit ===\nMass transit in New York City, most of which runs 24 hours a day, accounts for one in every three users of mass transit in the United States, and two-thirds of the nation\'s rail riders live in the New York City Metropolitan Area.\n\n\n==== Rail ====\nThe iconic New York City Subway system is the largest rapid transit system in the world when measured by stations in operation, with 472, and by length of routes. Nearly all of New York\'s subway system is open 24 hours a day, in contrast to the overnight shutdown common to systems in most cities, including Hong Kong, London, Paris, Seoul, and Tokyo. The New York City Subway is also the busiest metropolitan rail transit system in the Western Hemisphere, with 1.76 billion passenger rides in 2015, while Grand Central Terminal, also referred to as "Grand Central Station", is the world\'s largest railway station by number of train platforms.\n\nPublic transport is essential in New York City. 54.6% of New Yorkers commuted to work in 2005 using mass transit. This is in contrast to the rest of the United States, where 91% of commuters travel in automobiles to their workplace. According to the New York City Comptroller, workers in the New York City area spend an average of 6 hours and 18 minutes getting to work each week, the longest commute time in the nation among large cities. New York is the only US city in which a majority (52%) of households do not have a car; only 22% of Manhattanites own a car. Due to their high usage of mass transit, New Yorkers spend less of their household income on transportation than the national average, saving $19 billion annually on transportation compared to other urban Americans.New York City\'s commuter rail network is the largest in North America. The rail network, connecting New York City to its suburbs, consists of the Long Island Rail Road, Metro-North Railroad, and New Jersey Transit. The combined systems converge at Grand Central Terminal and Pennsylvania Station and contain more than 250 stations and 20 rail lines. In Queens, the elevated AirTrain people mover system connects JFK International Airport to the New York City Subway and the Long Island Rail Road; a separate AirTrain system is planned alongside the Grand Central Parkway to connect LaGuardia Airport to these transit systems. For intercity rail, New York City is served by Amtrak, whose busiest station by a significant margin is Pennsylvania Station on the West Side of Manhattan, from which Amtrak provides connections to Boston, Philadelphia, and Washington, D.C. along the Northeast Corridor, and long-distance train service to other North American cities.The Staten Island Railway rapid transit system solely serves Staten Island, operating 24 hours a day. The Port Authority Trans-Hudson (PATH train) links Midtown and Lower Manhattan to northeastern New Jersey, primarily Hoboken, Jersey City, and Newark. Like the New York City Subway, the PATH operates 24 hours a day; meaning three of the six rapid transit systems in the world which operate on 24-hour schedules are wholly or partly in New York (the others are a portion of the Chicago \'L\', the PATCO Speedline serving Philadelphia, and the Copenhagen Metro).\nMultibillion-dollar heavy rail transit projects under construction in New York City include the Second Avenue Subway, and the East Side Access project.\n\n\n==== Buses ====\n\nNew York City\'s public bus fleet runs 24/7 and is the largest in North America. The Port Authority Bus Terminal, the main intercity bus terminal of the city, serves 7,000 buses and 200,000 commuters daily, making it the busiest bus station in the world.\n\n\n=== Air ===\nNew York\'s airspace is the busiest in the United States and one of the world\'s busiest air transportation corridors. The three busiest airports in the New York metropolitan area include John F. Kennedy International Airport, Newark Liberty International Airport, and LaGuardia Airport; 130.5 million travelers used these three airports in 2016, and the city\'s airspace is the busiest in the nation. JFK and Newark Liberty were the busiest and fourth busiest U.S. gateways for international air passengers, respectively, in 2012; as of 2011, JFK was the busiest airport for international passengers in North America. Plans have advanced to expand passenger volume at a fourth airport, Stewart International Airport near Newburgh, New York, by the Port Authority of New York and New Jersey. Plans were announced in July 2015 to entirely rebuild LaGuardia Airport in a multibillion-dollar project to replace its aging facilities. Other commercial airports in or serving the New York metropolitan area include Long Island MacArthur Airport, Trenton–Mercer Airport and Westchester County Airport. The primary general aviation airport serving the area is Teterboro Airport.\n\n\n=== Ferries ===\n\nThe Staten Island Ferry is the world\'s busiest ferry route, carrying over 23 million passengers from July 2015 through June 2016 on the 5.2-mile (8.4 km) route between Staten Island and Lower Manhattan and running 24 hours a day. Other ferry systems shuttle commuters between Manhattan and other locales within the city and the metropolitan area.\nNYC Ferry, a NYCEDC initiative with routes planned to travel to all five boroughs, was launched in 2017, with second graders choosing the names of the ferries. Meanwhile, Seastreak ferry announced construction of a 600-passenger high-speed luxury ferry in September 2016, to shuttle riders between the Jersey Shore and Manhattan, anticipated to start service in 2017; this would be the largest vessel in its class.\n\n\n=== Taxis, transport startups, and trams ===\n\nOther features of the city\'s transportation infrastructure encompass more than 12,000 yellow taxicabs; various competing startup transportation network companies; and an aerial tramway that transports commuters between Roosevelt Island and Manhattan Island. Ride-sharing services have become significant competition for cab drivers in New York.\n\n\n=== Streets and highways ===\n\nDespite New York\'s heavy reliance on its vast public transit system, streets are a defining feature of the city. Manhattan\'s street grid plan greatly influenced the city\'s physical development. Several of the city\'s streets and avenues, like Broadway, Wall Street, Madison Avenue, and Seventh Avenue are also used as metonyms for national industries there: the theater, finance, advertising, and fashion organizations, respectively.\nNew York City also has an extensive web of expressways and parkways, which link the city\'s boroughs to each other and to northern New Jersey, Westchester County, Long Island, and southwestern Connecticut through various bridges and tunnels. Because these highways serve millions of outer borough and suburban residents who commute into Manhattan, it is quite common for motorists to be stranded for hours in traffic jams that are a daily occurrence, particularly during rush hour.New York City is also known for its rules regarding turning at red lights. Unlike the rest of the United States, New York State prohibits right or left turns on red in cities with a population greater than one million, to reduce traffic collisions and increase pedestrian safety. In New York City, therefore, all turns at red lights are illegal unless a sign permitting such maneuvers is present.\n\n\n==== River crossings ====\n\nNew York City is located on one of the world\'s largest natural harbors, and the boroughs of Manhattan and Staten Island are (primarily) coterminous with islands of the same names, while Queens and Brooklyn are located at the west end of the larger Long Island, and The Bronx is located at the southern tip of New York State\'s mainland. This situation of boroughs separated by water led to the development of an extensive infrastructure of well-known bridges and tunnels.\nThe George Washington Bridge is the world\'s busiest motor vehicle bridge, connecting Manhattan to Bergen County, New Jersey. The Verrazano-Narrows Bridge is the longest suspension bridge in the Americas and one of the world\'s longest. The Brooklyn Bridge is an icon of the city itself. The towers of the Brooklyn Bridge are built of limestone, granite, and Rosendale cement, and their architectural style is neo-Gothic, with characteristic pointed arches above the passageways through the stone towers. This bridge was also the longest suspension bridge in the world from its opening until 1903, and is the first steel-wire suspension bridge. The Queensboro Bridge is an important piece of cantilever architecture. The Manhattan Bridge, opened in 1909, is considered to be the forerunner of modern suspension bridges, and its design served as the model for many of the long-span suspension bridges around the world; the Manhattan Bridge, Throgs Neck Bridge, Triborough Bridge, and Verrazano-Narrows Bridge are all examples of Structural Expressionism.Manhattan Island is linked to New York City\'s outer boroughs and New Jersey by several tunnels as well. The Lincoln Tunnel, which carries 120,000 vehicles a day under the Hudson River between New Jersey and Midtown Manhattan, is the busiest vehicular tunnel in the world. The tunnel was built instead of a bridge to allow unfettered passage of large passenger and cargo ships that sailed through New York Harbor and up the Hudson River to Manhattan\'s piers. The Holland Tunnel, connecting Lower Manhattan to Jersey City, New Jersey, was the world\'s first mechanically ventilated vehicular tunnel when it opened in 1927. The Queens-Midtown Tunnel, built to relieve congestion on the bridges connecting Manhattan with Queens and Brooklyn, was the largest non-federal project in its time when it was completed in 1940. President Franklin D. Roosevelt was the first person to drive through it. The Brooklyn-Battery Tunnel (officially known as the Hugh L. Carey Tunnel) runs underneath Battery Park and connects the Financial District at the southern tip of Manhattan to Red Hook in Brooklyn.\n\n\n=== Cycling network ===\n\nCycling in New York City is associated with mixed cycling conditions that include dense urban proximities, relatively flat terrain, congested roadways with "stop-and-go" traffic, and streets with heavy pedestrian activity. The city\'s large cycling population includes utility cyclists, such as delivery and messenger services; cycling clubs for recreational cyclists; and increasingly commuters. Cycling is increasingly popular in New York City; in 2017 there were approximately 450,000 daily bike trips, compared with 170,000 daily bike trips in 2005. As of 2017, New York City had 1,333 miles of bike lanes, compared to 513 miles of bike lanes in 2006. As of 2019, there are 126 miles (203 km) of segregated or "protected" bike lanes citywide.\n\n\n== Environment ==\n\n\n=== Environmental impact reduction ===\nNew York City has focused on reducing its environmental impact and carbon footprint. Mass transit use in New York City is the highest in the United States. Also, by 2010, the city had 3,715 hybrid taxis and other clean diesel vehicles, representing around 28% of New York\'s taxi fleet in service, the most of any city in North America.New York\'s high rate of public transit use, over 200,000 daily cyclists as of 2014, and many pedestrian commuters make it the most energy-efficient major city in the United States. Walk and bicycle modes of travel account for 21% of all modes for trips in the city; nationally the rate for metro regions is about 8%. In both its 2011 and 2015 rankings, Walk Score named New York City the most walkable large city in the United States, and in 2018, Stacker ranked New York the most walkable U.S. city. Citibank sponsored the introduction of 10,000 public bicycles for the city\'s bike-share project in the summer of 2013. New York City\'s numerical "in-season cycling indicator" of bicycling in the city had hit an all-time high of 437 when measured in 2014.The city government was a petitioner in the landmark Massachusetts v. Environmental Protection Agency Supreme Court case forcing the EPA to regulate greenhouse gases as pollutants. The city is a leader in the construction of energy-efficient green office buildings, including the Hearst Tower among others. Mayor Bill de Blasio has committed to an 80% reduction in greenhouse gas emissions between 2014 and 2050 to reduce the city\'s contributions to climate change, beginning with a comprehensive "Green Buildings" plan.\n\n\n=== Water purity and availability ===\n\nNew York City is supplied with drinking water by the protected Catskill Mountains watershed. As a result of the watershed\'s integrity and undisturbed natural water filtration system, New York is one of only four major cities in the United States the majority of whose drinking water is pure enough not to require purification by water treatment plants. The city\'s municipal water system is the largest in the United States, moving over one billion gallons of water per day. The Croton Watershed north of the city is undergoing construction of a US$3.2 billion water purification plant to augment New York City\'s water supply by an estimated 290 million gallons daily, representing a greater than 20% addition to the city\'s current availability of water. The ongoing expansion of New York City Water Tunnel No. 3, an integral part of the New York City water supply system, is the largest capital construction project in the city\'s history, with segments serving Manhattan and The Bronx completed, and with segments serving Brooklyn and Queens planned for construction in 2020. In 2018, New York City announced a US$1 billion investment to protect the integrity of its water system and to maintain the purity of its unfiltered water supply.\n\n\n=== Air quality ===\nAccording to the 2016 World Health Organization Global Urban Ambient Air Pollution Database, the annual average concentration in New York City\'s air of particulate matter measuring 2.5 microns or less (PM2.5) was 7 micrograms per cubic meter, or 3 micrograms below the recommended limit of the WHO Air Quality Guidelines for the annual mean PM2.5. The New York City Department of Health and Mental Hygiene, in partnership with Queens College, conducts the New York Community Air Survey to measure pollutants at about 150 locations.\n\n\n=== Environmental revitalization ===\nNewtown Creek, a 3.5-mile (6-kilometer) a long estuary that forms part of the border between the boroughs of Brooklyn and Queens, has been designated a Superfund site for environmental clean-up and remediation of the waterway\'s recreational and economic resources for many communities. One of the most heavily used bodies of water in the Port of New York and New Jersey, it had been one of the most contaminated industrial sites in the country, containing years of discarded toxins, an estimated 30 million US gallons (110,000 m3) of spilled oil, including the Greenpoint oil spill, raw sewage from New York City\'s sewer system, and other accumulation.\n\n\n== Government and politics ==\n\n\n=== Government ===\n\nNew York City has been a metropolitan municipality with a mayor–council form of government since its consolidation in 1898. In New York City, the city government is responsible for public education, correctional institutions, public safety, recreational facilities, sanitation, water supply, and welfare services.\nThe Mayor and council members are elected to four-year terms. The City Council is a unicameral body consisting of 51 council members whose districts are defined by geographic population boundaries. Each term for the mayor and council members lasts four years and has a three consecutive-term limit, which is reset after a four-year break. The New York City Administrative Code, the New York City Rules, and the City Record are the code of local laws, compilation of regulations, and official journal, respectively.\n\nEach borough is coextensive with a judicial district of the state Unified Court System, of which the Criminal Court and the Civil Court are the local courts, while the New York Supreme Court conducts major trials and appeals. Manhattan hosts the First Department of the Supreme Court, Appellate Division while Brooklyn hosts the Second Department. There are also several extrajudicial administrative courts, which are executive agencies and not part of the state Unified Court System.\nUniquely among major American cities, New York is divided between, and is host to the main branches of, two different US district courts: the District Court for the Southern District of New York, whose main courthouse is on Foley Square near City Hall in Manhattan and whose jurisdiction includes Manhattan and the Bronx; and the District Court for the Eastern District of New York, whose main courthouse is in Brooklyn and whose jurisdiction includes Brooklyn, Queens, and Staten Island. The US Court of Appeals for the Second Circuit and US Court of International Trade are also based in New York, also on Foley Square in Manhattan.\n\n\n=== Politics ===\n\nThe present mayor is Bill de Blasio, the first Democrat since 1993. He was elected in 2013 with over 73% of the vote, and assumed office on January 1, 2014.\nThe Democratic Party holds the majority of public offices. As of April 2016, 69% of registered voters in the city are Democrats and 10% are Republicans. New York City has not been carried by a Republican in a statewide or presidential election since President Calvin Coolidge won the five boroughs in 1924. In 2012, Democrat Barack Obama became the first presidential candidate of any party to receive more than 80% of the overall vote in New York City, sweeping all five boroughs. Party platforms center on affordable housing, education, and economic development, and labor politics are of importance in the city.\nNew York is the most important source of political fundraising in the United States, as four of the top five ZIP Codes in the nation for political contributions are in Manhattan. The top ZIP Code, 10021 on the Upper East Side, generated the most money for the 2004 presidential campaigns of George W. Bush and John Kerry. The city has a strong imbalance of payments with the national and state governments. It receives 83 cents in services for every $1 it sends to the federal government in taxes (or annually sends $11.4 billion more than it receives back). City residents and businesses also sent an additional $4.1 billion in the 2009–2010 fiscal year to the state of New York than the city received in return.\n\n\n== Notable people ==\n\n\n== Global outreach ==\nIn 2006, the Sister City Program of the City of New York, Inc. was restructured and renamed New York City Global Partners. Through this program, New York City has expanded its international outreach to a network of cities worldwide, promoting the exchange of ideas and innovation between their citizenry and policymakers. New York\'s historic sister cities are denoted below by the year they joined New York City\'s partnership network.\n\n\n== See also ==\nOutline of New York City\n\n\n== Notes ==\n\n\n== References ==\n\n\n== Further reading ==\nBelden, E. Porter (1849). New York, Past, Present, and Future: Comprising a History of the City of New York, a Description of its Present Condition, and an Estimate of its Future Increase. New York: G.P. Putnam. From Google Books.\nBurgess, Anthony (1976). New York. New York: Little, Brown & Co. ISBN 978-90-6182-266-0.\nBurrows, Edwin G. & Wallace, Mike (1999), Gotham: A History of New York City to 1898, New York: Oxford University Press, ISBN 0-195-11634-8\nFederal Writers\' Project (1939). The WPA Guide to New York City (1995 reissue ed.). New York: The New Press. ISBN 978-1-56584-321-9.\nJackson, Kenneth T., ed. (1995), The Encyclopedia of New York City, New Haven: Yale University Press, ISBN 0300055366\nJackson, Kenneth T.; Dunbar, David S., eds. (2005). Empire City: New York Through the Centuries. Columbia University Press. ISBN 978-0-231-10909-3.\nLankevich, George L. (1998). American Metropolis: A History of New York City. NYU Press. ISBN 978-0-8147-5186-2.\nWhite, E.B. (1949). Here is New York (2000 reissue ed.). Little Bookroom.\nWhite, Norval & Willensky, Elliot (2000), AIA Guide to New York City (4th ed.), New York: Three Rivers Press, ISBN 978-0-8129-3107-5\nWhitehead, Colson (2003). The Colossus of New York: A City in 13 Parts. New York: Doubleday. ISBN 978-0-385-50794-3.\n\n\n== External links ==\nOfficial website\nNYC Go, official tourism website of New York City\nNew York City at Curlie\n Geographic data related to New York City at OpenStreetMap.\nCollections, 145,000 NYC photographs at the Museum of the City of New York\n"The New New York Skyline". National Geographic. November 2015. (Interactive.)'
print(ny.links[0]) # 10 Hudson Yards
print()
wikipedia.set_lang("fr")
print(wikipedia.summary("Facebook", sentences=1))
# Facebook [ˈfeɪsbʊk] est un réseau social en ligne qui permet à ses utilisateurs de publier des images, des photos, des vidéos, des fichiers et documents, d'échanger des messages, joindre et créer des groupes et d'utiliser une variété d'applications.
| 3,248.837838
| 116,585
| 0.803539
| 20,060
| 120,207
| 4.818694
| 0.202592
| 0.027518
| 0.019346
| 0.00809
| 0.081531
| 0.039684
| 0.018373
| 0.012963
| 0.008721
| 0.005897
| 0
| 0.030088
| 0.157254
| 120,207
| 36
| 116,586
| 3,339.083333
| 0.92332
| 0.996564
| 0
| 0.2
| 0
| 0
| 0.115
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.066667
| 0
| 0.066667
| 0.733333
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
6a52a517aad4c2334002518a25b23e50f1c47957
| 285
|
py
|
Python
|
ticket/forms.py
|
mdrkb/django-ticket
|
a26cecb6aa30ac791ba8d4aad007e206f8f15470
|
[
"MIT"
] | null | null | null |
ticket/forms.py
|
mdrkb/django-ticket
|
a26cecb6aa30ac791ba8d4aad007e206f8f15470
|
[
"MIT"
] | null | null | null |
ticket/forms.py
|
mdrkb/django-ticket
|
a26cecb6aa30ac791ba8d4aad007e206f8f15470
|
[
"MIT"
] | null | null | null |
from django import forms
class TicketResponseForm(forms.Form):
message = forms.CharField(
widget=forms.Textarea(attrs={'placeholder': 'Write your response', 'class': 'form-control'}), required=True)
response = forms.CharField(widget=forms.HiddenInput, required=True)
| 35.625
| 116
| 0.736842
| 32
| 285
| 6.5625
| 0.625
| 0.133333
| 0.190476
| 0.238095
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.133333
| 285
| 7
| 117
| 40.714286
| 0.850202
| 0
| 0
| 0
| 0
| 0
| 0.164912
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 0
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
6a68bc38167c8b1fa5365803118380a79fe89bd1
| 14,146
|
py
|
Python
|
tests/test/generic/combinations.py
|
exasol/script-languages
|
c5fc636a4ce18310d96d8dc5c019da7d033dc6f1
|
[
"MIT"
] | 6
|
2019-01-09T11:55:15.000Z
|
2021-06-25T19:52:42.000Z
|
tests/test/generic/combinations.py
|
exasol/script-languages
|
c5fc636a4ce18310d96d8dc5c019da7d033dc6f1
|
[
"MIT"
] | 65
|
2018-12-12T08:40:38.000Z
|
2022-02-28T09:19:45.000Z
|
tests/test/generic/combinations.py
|
exasol/script-languages
|
c5fc636a4ce18310d96d8dc5c019da7d033dc6f1
|
[
"MIT"
] | 9
|
2018-11-23T08:59:09.000Z
|
2020-02-04T12:56:35.000Z
|
#!/usr/bin/env python2.7
import os
import sys
sys.path.append(os.path.realpath(__file__ + '/../../../lib'))
import udf
from udf import (
requires,
SkipTest,
useData,
)
class Test(udf.TestCase):
def setUp(self):
self.query('DROP SCHEMA combinations CASCADE', ignore_errors=True)
self.query('CREATE SCHEMA combinations')
self.query('CREATE TABLE small(x DOUBLE, y DOUBLE)')
self.query('INSERT INTO small VALUES (0.1, 0.2), (0.2, 0.1)')
class Combinations_1_ary(Test):
@requires('SET_RETURNS')
def test_set_returns(self):
rows = self.query('''
SELECT fn1.SET_RETURNS(x,y)
FROM small''')
self.assertEqual(round(0.6 / 2), round(rows[0][0] / 2))
@requires('SCALAR_RETURNS')
def test_scalar_returns(self):
rows = self.query('''
SELECT round(fn1.scalar_returns(x,y) / 2)
FROM small''')
self.assertRowsEqual([(round(0.3 / 2),), ( round(0.3 / 2),)], rows)
@requires('SCALAR_EMITS')
def test_scalar_emits(self):
rows = self.query('''
SELECT fn1.scalar_emits(x * 10 ,y * 10)
FROM small''')
self.assertRowsEqual([(1, 1,), (2, 4,)], rows)
@requires('SET_EMITS')
def test_set_emits(self):
rows = self.query('''
SELECT fn1.set_emits(x * 10 ,y * 10)
FROM small''')
self.assertRowsEqual([(2.0, 1.0,),(1.0, 2.0,)] , rows)
@requires('SCALAR_RETURNS')
def test_two_scalar_returns(self):
rows = self.query('''
SELECT
fn1.scalar_returns(fn1.scalar_returns(x * 10 ,y * 10),
fn1.scalar_returns(y * 10 ,x * 10))
FROM small''')
self.assertRowsEqual([(6,), (6,)], rows)
class Combinations_2_ary_scalar_returns(Test):
@requires('SCALAR_RETURNS')
@requires('SCALAR_EMITS')
def test_scalar_returns_scalar_emits(self):
rows = self.query('''
SELECT fn1.scalar_returns(x * 10 ,y * 10 )
FROM (
SELECT fn1.scalar_emits(x * 10 ,y * 10)
FROM small
)''')
self.assertRowsEqual([(20,), (60,)], rows)
@requires('SCALAR_RETURNS')
@requires('SET_RETURNS')
def test_scalar_returns_set_returns_inline(self):
rows = self.query('''
SELECT
fn1.scalar_returns(
fn1.set_returns(x * 10, y * 10),
fn1.set_returns(x * 10, y * 10)
)
FROM small''')
self.assertRowsEqual([(12,)], rows)
@requires('SCALAR_RETURNS')
@requires('SET_RETURNS')
def test_scalar_returns_set_returns_1(self):
rows = self.query('''
SELECT fn1.scalar_returns(a, 5)
FROM (
SELECT fn1.set_returns(x * 10, y * 10) AS a
FROM SMALL
)
''')
self.assertRowsEqual([(11,)], rows)
@requires('SCALAR_RETURNS')
@requires('SET_RETURNS')
def test_scalar_returns_set_returns_2(self):
rows = self.query('''
SELECT fn1.scalar_returns(aa.a, bb.a)
FROM (
SELECT fn1.set_returns(x * 10, y * 20) AS a
FROM SMALL
) AS aa,
(
SELECT fn1.set_returns(x * 20, y * 10) AS a
FROM SMALL
) AS bb
''')
self.assertRowsEqual([(18,)], rows)
@requires('SCALAR_RETURNS')
@requires('SET_EMITS')
def test_scalar_returns_set_emits_1(self):
rows = self.query('''
SELECT fn1.scalar_returns(x * 10, y * 10)
FROM (
SELECT fn1.set_emits(x * 10, y * 10)
FROM small
)''')
self.assertRowsEqual([(30,), (30,)], rows)
@requires('SCALAR_RETURNS')
@requires('SET_EMITS')
def test_scalar_returns_set_emits_2(self):
rows = self.query('''
SELECT fn1.scalar_returns(aa.x * 10, bb.x * 10)
FROM (
SELECT fn1.set_emits(x * 10, y * 10)
FROM small
) AS aa,
(
SELECT fn1.set_emits(x * 10, y * 10)
FROM small
) AS bb
WHERE aa.x = bb.y and aa.y = bb.x
''')
self.assertRowsEqual([(30,), (30,)], rows)
class Combinations_2_ary_scalar_emits(Test):
@requires('SET_EMITS')
@requires('SCALAR_RETURNS')
def test_scalar_emits_scalar_returns_inline(self):
rows = self.query('''
SELECT
fn1.scalar_emits(
fn1.scalar_returns(x * 10, y * 10),
fn1.scalar_returns(y * 10, x * 10)
)
FROM small''')
self.assertRowsEqual([(3,9,), (3,9,)], rows)
@requires('SET_EMITS')
@requires('SCALAR_RETURNS')
def test_scalar_emits_scalar_returns(self):
rows = self.query('''
SELECT fn1.scalar_emits(a, b)
FROM (
SELECT
fn1.scalar_returns(x * 10 ,y * 10) AS A,
fn1.scalar_returns(y * 10 ,x * 10) AS B
FROM small
)
''')
self.assertRowsEqual([(3,9,), (3,9,)], rows)
@requires('SCALAR_EMITS')
def test_scalar_emits_scalar_emits(self):
rows = self.query('''
SELECT fn1.scalar_emits(x * 10,y * 10)
FROM (
SELECT fn1.scalar_emits(x * 10,y * 10)
FROM small
)
ORDER by x,y''')
r = [(10.0, 100.0)]
r.extend([(i , i*i) for i in range(20,41)])
self.assertRowsEqual(r, rows)
@requires('SET_RETURNS')
@requires('SCALAR_EMITS')
def test_scalar_emits_set_returns_inline(self):
with self.assertRaisesRegexp(Exception, 'encapsulated set function'):
self.query('''
SELECT
fn1.scalar_emits(
fn1.set_returns(x * 10, y * 10),
fn1.set_returns(x * 10, y * 10)
)
FROM small''')
@requires('SET_RETURNS')
@requires('SCALAR_EMITS')
def test_scalar_emits_set_returns(self):
rows = self.query('''
SELECT fn1.scalar_emits(a, b)
FROM (
SELECT fn1.set_returns(x * 10, y * 10) AS a
FROM small
),
(
SELECT fn1.set_returns(x * 10, y *10) AS b
FROM small
)
''')
self.assertRowsEqual([(6, 36)], rows)
@requires('SET_EMITS')
@requires('SCALAR_EMITS')
def test_scalar_emits_set_emits(self):
rows = self.query('''
SELECT fn1.scalar_emits(x * 10, y * 10)
FROM (
SELECT fn1.set_emits(x * 10, y * 10)
FROM small
)''')
r = ([(i , i*i) for i in range(10,21)])
self.assertRowsEqual(r, rows)
class Combinations_2_ary_set_returns(Test):
@requires('SET_RETURNS')
@requires('SCALAR_RETURNS')
def test_set_returns_scalar_returns(self):
rows = self.query('''
SELECT
fn1.set_returns(
fn1.scalar_returns(x * 10, y * 10),
fn1.scalar_returns(y * 10, x * 10)
)
FROM small''')
self.assertRowsEqual([(12,)], rows)
@requires('SET_RETURNS')
@requires('SCALAR_EMITS')
def test_set_returns_scalar_emits(self):
rows = self.query('''
SELECT fn1.set_returns(x*10, y*10)
FROM (
SELECT fn1.scalar_emits(x*10, y*10)
FROM small
)''')
self.assertRowsEqual([(80,)], rows)
@requires('SET_RETURNS')
def test_set_returns_set_returns_inline(self):
with self.assertRaisesRegexp(Exception, 'encapsulated set function'):
self.query('''
SELECT
fn1.set_returns(
fn1.set_returns(x*10, y*10),
fn1.set_returns(x*10, y*10)
)
FROM small''')
@requires('SET_RETURNS')
def test_set_returns_set_returns(self):
rows = self.query('''
SELECT fn1.set_returns(a, b)
FROM(
SELECT fn1.set_returns(x*20, y*30) AS a
FROM small
),
(
SELECT fn1.set_returns(x*50, y*70) AS b
FROM small
)''')
self.assertRowsEqual([(51,)], rows)
@requires('SET_RETURNS')
@requires('SET_EMITS')
def test_set_returns_set_emits(self):
rows = self.query('''
SELECT fn1.set_returns(x*10, y*10)
FROM (
SELECT fn1.set_emits(x*10, y*10)
FROM small
)''')
self.assertRowsEqual([(60,)], rows)
class Combinations_2_ary_set_emits(Test):
@requires('SET_EMITS')
@requires('SCALAR_RETURNS')
def test_set_emits_scalar_returns(self):
rows = self.query('''
SELECT
fn1.set_emits(
fn1.scalar_returns(x*10, y*10),
fn1.scalar_returns(y*10, x*10)
)
FROM small''')
self.assertRowsEqual([(3,3,), (3,3,)], rows)
@requires('SET_EMITS')
@requires('SCALAR_EMITS')
def test_set_emits_scalar_emits(self):
rows = self.query('''
SELECT fn1.set_emits(x*10, y*10)
FROM (
SELECT fn1.scalar_emits(x*10, 10*y)
FROM small
)
ORDER BY x, y;''')
self.assertRowsEqual([(10,10,), (40,20,)], rows)
@requires('SET_EMITS')
@requires('SET_RETURNS')
def test_set_emits_set_returns_inline(self):
with self.assertRaisesRegexp(Exception, 'encapsulated set function'):
self.query('''
SELECT
fn1.set_emits(
fn1.set_returns(x*10, 10*y),
fn1.set_returns(10*x, y*10)
)
FROM small''')
@requires('SET_EMITS')
@requires('SET_RETURNS')
def test_set_emits_set_returns(self):
rows = self.query('''
SELECT fn1.set_emits(a, b)
FROM (
SELECT fn1.set_returns(x*20, 30*y) AS a
FROM small
),
(
SELECT fn1.set_returns(50*x, y*70) AS b
FROM small
)
''')
self.assertRowsEqual([(36, 15,)], rows)
@requires('SET_EMITS')
def test_set_emits_set_emits(self):
rows = self.query('''
SELECT fn1.set_emits(x * 10 , 10 * y)
FROM (
SELECT fn1.set_emits(x * 10, y *10)
FROM small
)
ORDER BY x, y;''')
self.assertRowsEqual([(10,20,), (20,10,)], rows)
class Combinations_3_ary(Test):
@requires('BASIC_RANGE')
@requires('BASIC_SUM')
@requires('BASIC_SUM_GRP')
def test_set_returns_set_emits_scalar_emits(self):
rows = self.query('''
SELECT fn1.basic_sum(s)
FROM (
SELECT fn1.basic_sum_grp(n)
FROM(
SELECT fn1.basic_range(10)
FROM DUAL
)
)''')
self.assertRowsEqual([(45,)], rows)
@requires('BASIC_SUM')
@requires('BASIC_RANGE')
@requires('SCALAR_EMITS')
def test_set_returns_scalar_emits_scalar_emits(self):
rows = self.query('''
SELECT fn1.basic_sum(x)
FROM (
SELECT fn1.scalar_emits(n, n+2)
FROM(
SELECT fn1.basic_range(10)
FROM DUAL
)
)''')
self.assertRowsEqual([(165,)], rows)
@requires('BASIC_SUM')
@requires('BASIC_RANGE')
@requires('SCALAR_RETURNS')
def test_set_returns_scalar_returns_scalar_emits(self):
rows = self.query('''
SELECT fn1.basic_sum(x)
FROM (
SELECT fn1.scalar_returns(n, 2) AS x
FROM(
SELECT fn1.basic_range(10)
FROM DUAL
)
)''')
self.assertRowsEqual([(65,)], rows)
class Combinations_n_ary(Test):
@staticmethod
def partial_sum(n, degree):
def basic_range(n, d):
if d == 0:
return range(n)
else:
return sum([range(x) for x in basic_range(n+1, d-1)], [])
return len(basic_range(n, degree))
@useData((i,) for i in range(10))
def test_n_scalar_emits(self, n):
if 'BASIC_RANGE' not in udf.capabilities:
raise SkipTest('requires: BASIC_RANGE')
self.query(
'SELECT fn1.basic_range(n+1) FROM (\n' * n +
'SELECT fn1.basic_range(5) FROM DUAL\n' +
')' * n)
self.assertEquals(self.partial_sum(5, n), self.rowcount())
@useData((i,) for i in range(10))
def test_set_returns_n_scalar_emits(self, n):
if 'BASIC_RANGE' not in udf.capabilities:
raise SkipTest('requires: BASIC_RANGE')
rows = self.query(
'SELECT max(n) FROM (' +
'SELECT fn1.basic_range(n+1) FROM (\n' * n +
'SELECT fn1.basic_range(5) FROM DUAL\n' +
')' * (n+1))
self.assertEquals(4, rows[0][0])
if __name__ == '__main__':
udf.main()
# vim: ts=4:sts=4:sw=4:et:fdm=indent
| 32.444954
| 77
| 0.488336
| 1,592
| 14,146
| 4.143844
| 0.082286
| 0.080491
| 0.020009
| 0.029104
| 0.834773
| 0.810672
| 0.771411
| 0.735486
| 0.693194
| 0.551766
| 0
| 0.049324
| 0.388025
| 14,146
| 435
| 78
| 32.51954
| 0.712718
| 0.0041
| 0
| 0.62141
| 0
| 0.002611
| 0.534005
| 0.032586
| 0
| 0
| 0
| 0
| 0.083551
| 1
| 0.091384
| false
| 0
| 0.010444
| 0
| 0.130548
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6a92dbbc22103722acd6aefc13c1ea277ca191d4
| 498
|
py
|
Python
|
docker_sdk_api/domain/services/contract/abstract_job_utility_service.py
|
hadikoub/BMW-TensorFlow-Training-GUI
|
0c18e65529b3fcb6a7ea9e57f8e4e2e5e6e93d5d
|
[
"Apache-2.0"
] | 1
|
2020-06-22T12:56:58.000Z
|
2020-06-22T12:56:58.000Z
|
docker_sdk_api/domain/services/contract/abstract_job_utility_service.py
|
hadikoub/BMW-TensorFlow-Training-GUI
|
0c18e65529b3fcb6a7ea9e57f8e4e2e5e6e93d5d
|
[
"Apache-2.0"
] | null | null | null |
docker_sdk_api/domain/services/contract/abstract_job_utility_service.py
|
hadikoub/BMW-TensorFlow-Training-GUI
|
0c18e65529b3fcb6a7ea9e57f8e4e2e5e6e93d5d
|
[
"Apache-2.0"
] | null | null | null |
from abc import ABC, abstractmethod
from domain.models.paths import Paths
from typing import List
from domain.models.container_info import ContainerInfo
class AbstractJobUtilityService(ABC):
@abstractmethod
def get_all_jobs(self) -> List[str]: raise NotImplementedError
@abstractmethod
def get_finished_jobs(self) -> List[str]: raise NotImplementedError
@abstractmethod
def get_container_logs(self, container_info: ContainerInfo) -> List[str]: raise NotImplementedError
| 31.125
| 103
| 0.791165
| 58
| 498
| 6.655172
| 0.413793
| 0.132124
| 0.15544
| 0.240933
| 0.305699
| 0.305699
| 0.305699
| 0.305699
| 0.305699
| 0
| 0
| 0
| 0.140562
| 498
| 15
| 104
| 33.2
| 0.901869
| 0
| 0
| 0.272727
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.272727
| false
| 0
| 0.363636
| 0
| 0.727273
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6aa814b8170680ce0a77927df0ad0649965a2d93
| 5,262
|
py
|
Python
|
ProjectApplication/grant_management/urls.py
|
code-review-doctor/project-application
|
d85b40b69572efbcda24ce9c40803f76d8ffd192
|
[
"MIT"
] | null | null | null |
ProjectApplication/grant_management/urls.py
|
code-review-doctor/project-application
|
d85b40b69572efbcda24ce9c40803f76d8ffd192
|
[
"MIT"
] | null | null | null |
ProjectApplication/grant_management/urls.py
|
code-review-doctor/project-application
|
d85b40b69572efbcda24ce9c40803f76d8ffd192
|
[
"MIT"
] | null | null | null |
from django.urls import path
import grant_management.views
urlpatterns = [
path('logged/grant-management/project/list/',
grant_management.views.ProjectList.as_view(),
name='logged-grant_management-project-list'),
path('logged/grant-management/project/<int:pk>/',
grant_management.views.ProjectDetail.as_view(),
name='logged-grant_management-project-detail'),
path('logged/grant-management/project/<int:pk>/add-comment/',
grant_management.views.ProjectDetailCommentAdd.as_view(),
name='logged-grant_management-project-comment-add'),
path('logged/grant-management/project/<int:pk>/update/',
grant_management.views.ProjectUpdate.as_view(),
name='logged-grant_management-project-update'),
path('logged/grant-management/project/add/',
grant_management.views.ProjectCreate.as_view(),
name='logged-grant_management-project-add'),
path('logged/grant-management/project/<int:project>/information/update/',
grant_management.views.ProjectBasicInformationUpdateView.as_view(),
name='logged-grant_management-project-basic-information-update'),
path('logged/grant-management/project/<int:project>/lay_summaries/update/',
grant_management.views.LaySummariesUpdateView.as_view(),
name='logged-grant_management-lay_summaries-update'),
path('logged/grant-management/project/<int:project>/blog_posts/update/',
grant_management.views.BlogPostsUpdateView.as_view(),
name='logged-grant_management-blog_posts-update'),
path('logged/grant-management/project/<int:project>/scientific_reports/update/',
grant_management.views.ScientificReportsUpdateView.as_view(),
name='logged-grant_management-scientific_reports-update'),
path('logged/grant-management/project/<int:project>/locations/update/',
grant_management.views.LocationsUpdateView.as_view(),
name='logged-grant_management-locations-update'),
path('logged/grant-management/project/<int:project>/grant-agreement/add/',
grant_management.views.GrantAgreementAddView.as_view(),
name='logged-grant_management-grant_agreement-add'),
path('logged/grant-management/grant-agreement/<int:pk>/update/',
grant_management.views.GrantAgreementUpdateView.as_view(),
name='logged-grant_management-grant_agreement-update'),
path('logged/grant-management/grant-agreement/<int:pk>/add-comment/',
grant_management.views.GrantAgreementCommentAdd.as_view(),
name='logged-grant_management-grant_agreement-comment-add'),
path('logged/grant-management/project/<int:project>/invoices/update/',
grant_management.views.InvoicesUpdateView.as_view(),
name='logged-grant_management-invoices-update'),
path('logged/grant-management/project/<int:project>/financial_reports/update/',
grant_management.views.FinancialReportsUpdateView.as_view(),
name='logged-grant_management-financial_reports-update'),
# path('logged/grant-management/project/<int:project>/finances/update/',
# grant_management.views.FinancesViewUpdate.as_view(),
# name='logged-grant_management-finances-update'),
path('logged/grant-management/project/<int:project>/installments/update/',
grant_management.views.InstallmentsUpdateView.as_view(),
name='logged-grant_management-installments-update'),
path('logged/grant-management/project/<int:project>/media/update/',
grant_management.views.MediaUpdateView.as_view(),
name='logged-grant_management-media-update'),
path('logged/grant-management/project/<int:project>/data/update/',
grant_management.views.DatasetUpdateView.as_view(),
name='logged-grant_management-data-update'),
path('logged/grant-management/project/<int:project>/publications/update/',
grant_management.views.PublicationsUpdateView.as_view(),
name='logged-grant_management-publications-update'),
path('logged/grant-management/project/<int:project>/social_media/update/',
grant_management.views.SocialMediaUpdateView.as_view(),
name='logged-grant_management-social-media-update'),
path('logged/grant-management/project/<int:project>/milestones/update/',
grant_management.views.MilestoneUpdateView.as_view(),
name='logged-grant_management-milestones-update'),
path('logged/grant-management/project/<int:project>/close/',
grant_management.views.CloseProjectView.as_view(),
name='logged-grant_management-close_project'),
path('lay-summaries/<int:call>/for_website/',
grant_management.views.LaySummariesRaw.as_view(),
name='lay-summaries-for_website'),
path('logged/autocomplete/milestones-category-names/',
grant_management.views.MilestoneCategoriesAutocomplete.as_view(create_field='name'),
name='logged-grant_management-autocomplete-milestones-names'),
path('api/media/list/', grant_management.views.ApiListMediaView.as_view(),
name='api-list-media-view'),
path('api/media/list/deleted/', grant_management.views.ApiListMediaDeletedView.as_view(),
name='api-list-media-deleted-view'),
]
| 50.114286
| 93
| 0.72824
| 574
| 5,262
| 6.510453
| 0.135889
| 0.301044
| 0.264116
| 0.202301
| 0.581482
| 0.533315
| 0.381322
| 0.283918
| 0.0578
| 0
| 0
| 0
| 0.131319
| 5,262
| 104
| 94
| 50.596154
| 0.817545
| 0.034588
| 0
| 0
| 0
| 0
| 0.486013
| 0.478526
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.025
| 0
| 0.025
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6aac8e508765b26a62e90ed6713a802f9430b8e3
| 11,961
|
py
|
Python
|
functions_handdle_state.py
|
vinc-r/Tetris
|
f5afe1d8420e26e2c565c20c60207245f1b12b8c
|
[
"MIT"
] | null | null | null |
functions_handdle_state.py
|
vinc-r/Tetris
|
f5afe1d8420e26e2c565c20c60207245f1b12b8c
|
[
"MIT"
] | 1
|
2020-08-24T14:41:40.000Z
|
2020-09-09T10:59:15.000Z
|
functions_handdle_state.py
|
vinc-r/Tetris
|
f5afe1d8420e26e2c565c20c60207245f1b12b8c
|
[
"MIT"
] | null | null | null |
import pygame
from constants import *
def handle_state_playing(game, screen, sound, state="playing", running=True):
# update clock
game.update_time_playing()
# update board game
if game.update_game() == "game_over":
return "game_over", True
# apply background
screen.fill(BLACK)
# apply grid
for cube in game.grid:
screen.blit(cube.image, cube.rect)
# apply actual tetrimino
for cube in game.tetrimino.cubes:
screen.blit(cube.image, cube.rect)
# apply grid next tetrimino
for cube in game.grid_nex_tetris:
screen.blit(cube.image, cube.rect)
# apply next tetrimino on grid next tetrimino
for cube in game.next_tetrimino.cubes:
screen.blit(cube.image, cube.rect)
# apply statistics board
for text in game.board:
screen.blit(text.text, text.rect)
# apply buttons
for button in game.buttons:
screen.blit(button.image, button.rect)
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONUP:
if 0 < event.pos[0] - BUTTON_PAUSE_POS[0] < BUTTON_PAUSE_SIZE[0] and \
0 < event.pos[1] - BUTTON_PAUSE_POS[1] < BUTTON_PAUSE_SIZE[1]:
return "pause", running
elif 0 < event.pos[0] - BUTTON_QUIT_POS[0] < BUTTON_QUIT_SIZE[0] and \
0 < event.pos[1] - BUTTON_QUIT_POS[1] < BUTTON_QUIT_SIZE[1]:
return "menu", running
elif 0 < event.pos[0] - BUTTON_SOUND_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_SOUND_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(VOLUME)
elif 0 < event.pos[0] - BUTTON_MUTE_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_MUTE_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(0)
elif 0 < event.pos[0] - BUTTON_SOUNDUP_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_SOUNDUP_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(sound.get_volume() + 0.1)
elif 0 < event.pos[0] - BUTTON_SOUNDDOWN_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_SOUNDDOWN_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(sound.get_volume() - 0.1)
elif event.type == pygame.KEYDOWN:
if event.key == AZERTY.K_p:
state = "pause"
elif event.key == AZERTY.K_q:
return "menu", running
elif event.key == AZERTY.K_SPACE:
game.tetrimino.drop_tetrimino(game.grid_list)
game.tetrimino.time_last_move_down = game.speed * 1000
game.actions += 1
if game.update_game() == "game_over":
return "game_over", running
elif event.key in [AZERTY.K_LEFT, AZERTY.K_RIGHT, AZERTY.K_DOWN]:
game.pressed[event.key] = True
elif event.key == AZERTY.K_UP:
game.tetrimino.spin_tetrimino(game.grid_list)
elif event.type == pygame.KEYUP:
if event.key in [AZERTY.K_LEFT, AZERTY.K_RIGHT, AZERTY.K_DOWN]:
game.pressed[event.key] = False
if event.key == AZERTY.K_LEFT:
game.tetrimino.time_last_move_left = TIME_BETWEEN_MOVE # init able to move
game.tetrimino.clock_left.tick()
if event.key == AZERTY.K_RIGHT:
game.tetrimino.time_last_move_right = TIME_BETWEEN_MOVE # init able to move
game.tetrimino.clock_right.tick()
if event.key == AZERTY.K_DOWN:
game.tetrimino.time_last_move_down = 0 # init not able to move yet
game.tetrimino.clock_down.tick()
# if window is closed
elif event.type == pygame.QUIT:
return "end", False
return state, running
def handle_state_menu(game, screen, bg, sound, state="menu", running=True):
# update clock
game.update_time_out_of_playing()
screen.blit(bg, BG_MENU_POS)
# apply buttons
for button in game.menu_buttons:
screen.blit(button.image, button.rect)
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONUP:
if 0 < event.pos[0] - BUTTON_MENU_PLAY_POS[0] < BUTTON_MENU_PLAY_SIZE[0] and \
0 < event.pos[1] - BUTTON_MENU_PLAY_POS[1] < BUTTON_MENU_PLAY_SIZE[1]:
state = "playing"
game.new_game()
elif 0 < event.pos[0] - BUTTON_MENU_QUIT_POS[0] < BUTTON_MENU_QUIT_SIZE[0] and \
0 < event.pos[1] - BUTTON_MENU_QUIT_POS[1] < BUTTON_MENU_QUIT_SIZE[1]:
return "end", False
elif 0 < event.pos[0] - BUTTON_MENU_LEADERBOARD_POS[0] < BUTTON_MENU_LEADERBOARD_SIZE[0] and \
0 < event.pos[1] - BUTTON_MENU_LEADERBOARD_POS[1] < BUTTON_MENU_LEADERBOARD_SIZE[1]:
return "leaderboard", True
# if window is closed
elif event.type == pygame.QUIT:
return "end", False
elif event.type == pygame.KEYUP:
if event.key == AZERTY.K_p:
state = "playing"
game.new_game()
elif event.type == pygame.KEYDOWN:
if event.key == AZERTY.K_q:
return "end", False
if event.key == AZERTY.K_l:
return "leaderboard", True
return state, running
def handle_state_pause(game, screen, sound, state="pause", running=True):
# update clock
game.update_time_out_of_playing()
# apply pause button
screen.blit(game.pause_message.image, game.pause_message.rect)
# apply volume buttons
for button in game.buttons[2:]:
screen.blit(button.image, button.rect)
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONUP:
if 0 < event.pos[0] - PAUSE_MESSAGE_POS[0] < PAUSE_MESSAGE_SIZE[0] and \
0 < event.pos[1] - PAUSE_MESSAGE_POS[1] < PAUSE_MESSAGE_SIZE[1]:
state = "playing"
elif 0 < event.pos[0] - BUTTON_SOUND_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_SOUND_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(VOLUME)
elif 0 < event.pos[0] - BUTTON_MUTE_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_MUTE_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(0)
elif 0 < event.pos[0] - BUTTON_SOUNDUP_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_SOUNDUP_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(sound.get_volume() + 0.1)
elif 0 < event.pos[0] - BUTTON_SOUNDDOWN_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_SOUNDDOWN_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(sound.get_volume() - 0.1)
elif event.type == pygame.KEYUP:
if state == "pause" and event.key == AZERTY.K_r:
state = "playing"
# if window is closed
elif event.type == pygame.QUIT:
return "end", False
return state, running
def handle_state_game_over(game, screen, sound, state="game_over", running=True):
# apply background
screen.fill(BLACK)
# apply grid
for cube in game.grid:
screen.blit(cube.image, cube.rect)
# apply actual tetrimino
for cube in game.tetrimino.cubes:
screen.blit(cube.image, cube.rect)
# apply grid next tetrimino
for cube in game.grid_nex_tetris:
screen.blit(cube.image, cube.rect)
# apply next tetrimino on grid next tetrimino
for cube in game.next_tetrimino.cubes:
screen.blit(cube.image, cube.rect)
# apply statistics board
for text in game.board:
screen.blit(text.text, text.rect)
# apply buttons
for button in game.buttons:
screen.blit(button.image, button.rect)
# apply game over image
screen.blit(pygame.image.load("img/game_over.jpg"), GAME_OVER_IMAGE_POS)
screen.blit(pygame.image.load("img/menu.png"), GAME_OVER_MENU_IMAGE_POS)
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONUP:
if 0 < event.pos[0] - GAME_OVER_MENU_IMAGE_POS[0] < GAME_OVER_MENU_IMAGE_SIZE[0] and \
0 < event.pos[1] - GAME_OVER_MENU_IMAGE_POS[1] < GAME_OVER_MENU_IMAGE_SIZE[1]:
return "menu", running
elif 0 < event.pos[0] - BUTTON_SOUND_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_SOUND_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(VOLUME)
elif 0 < event.pos[0] - BUTTON_MUTE_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_MUTE_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(0)
elif 0 < event.pos[0] - BUTTON_SOUNDUP_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_SOUNDUP_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(sound.get_volume() + 0.1)
elif 0 < event.pos[0] - BUTTON_SOUNDDOWN_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_SOUNDDOWN_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(sound.get_volume() - 0.1)
elif event.type == pygame.KEYDOWN:
print(event.key)
if event.key == AZERTY.K_m:
return "menu", running
# if window is closed
elif event.type == pygame.QUIT:
return "end", False
return state, running
def handle_state_leaderboard(game, screen, sound, state="leaderboard", running=True):
# apply background
screen.fill(BLACK)
screen.blit(game.leaderboard.bg, game.leaderboard.bg_pos)
screen.blit(game.leaderboard.botton_menu, game.leaderboard.botton_menu_pos)
# apply leaderboard
for text in game.leaderboard.board:
screen.blit(text.text, text.rect)
# apply volume buttons
for button in game.buttons[2:]:
screen.blit(button.image, button.rect)
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONUP:
if 0 < event.pos[0] - LEADERBOARD_MENU_POS[0] < LEADERBOARD_MENU_SIZE[0] and \
0 < event.pos[1] - LEADERBOARD_MENU_POS[1] < LEADERBOARD_MENU_SIZE[1]:
return "menu", True
elif 0 < event.pos[0] - BUTTON_SOUND_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_SOUND_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(VOLUME)
elif 0 < event.pos[0] - BUTTON_MUTE_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_MUTE_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(0)
elif 0 < event.pos[0] - BUTTON_SOUNDUP_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_SOUNDUP_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(sound.get_volume() + 0.1)
elif 0 < event.pos[0] - BUTTON_SOUNDDOWN_POS[0] < VOLUME_BUTTON_SIZE and \
0 < event.pos[1] - BUTTON_SOUNDDOWN_POS[1] < VOLUME_BUTTON_SIZE:
sound.set_volume(sound.get_volume() - 0.1)
elif event.type == pygame.KEYDOWN:
if event.key == AZERTY.K_m:
return "menu", True
# if window is closed
elif event.type == pygame.QUIT:
return "end", False
return state, running
| 37.731861
| 107
| 0.57955
| 1,556
| 11,961
| 4.242288
| 0.070694
| 0.04363
| 0.065445
| 0.036358
| 0.82942
| 0.78882
| 0.725799
| 0.690653
| 0.667929
| 0.638843
| 0
| 0.023121
| 0.320207
| 11,961
| 317
| 108
| 37.731861
| 0.78871
| 0.055681
| 0
| 0.695431
| 0
| 0
| 0.019276
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.025381
| false
| 0
| 0.010152
| 0
| 0.152284
| 0.005076
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6ab3f5d0a45bff9f950c278c08bac70924305d42
| 46
|
py
|
Python
|
python/testData/copyPaste/PasteToStringLiteral.src.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 2
|
2019-04-28T07:48:50.000Z
|
2020-12-11T14:18:08.000Z
|
python/testData/copyPaste/PasteToStringLiteral.src.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 173
|
2018-07-05T13:59:39.000Z
|
2018-08-09T01:12:03.000Z
|
python/testData/copyPaste/PasteToStringLiteral.src.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 2
|
2020-03-15T08:57:37.000Z
|
2020-04-07T04:48:14.000Z
|
if True:
s = "<selection>foo</selection>"
| 15.333333
| 36
| 0.608696
| 6
| 46
| 4.666667
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.195652
| 46
| 2
| 37
| 23
| 0.756757
| 0
| 0
| 0
| 0
| 0
| 0.565217
| 0.565217
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6ab7a4e947478c7298c17b8e7bc3528252413314
| 158
|
py
|
Python
|
Assignment 12.py
|
Raythere/Pythion-fundamentals
|
5b445ef5e015a9a096177a181faebeb8505943bb
|
[
"MIT"
] | null | null | null |
Assignment 12.py
|
Raythere/Pythion-fundamentals
|
5b445ef5e015a9a096177a181faebeb8505943bb
|
[
"MIT"
] | null | null | null |
Assignment 12.py
|
Raythere/Pythion-fundamentals
|
5b445ef5e015a9a096177a181faebeb8505943bb
|
[
"MIT"
] | null | null | null |
"""Assignment 12"""
#Here we are observing the addresses of variable x and y
x = 10
y = x
print("Address of x is: ",id(x))
print("Address of y is: ",id(y))
| 17.555556
| 56
| 0.64557
| 31
| 158
| 3.290323
| 0.580645
| 0.039216
| 0.254902
| 0.294118
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.031496
| 0.196203
| 158
| 8
| 57
| 19.75
| 0.771654
| 0.436709
| 0
| 0
| 0
| 0
| 0.409639
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
6aba627f26a30ddbe94e7053b3aaa3522cb568b8
| 1,481
|
py
|
Python
|
python/examples/dataframe/concat.py
|
Sandeepa1995/cylon
|
a42d04ad9a65b20c84a15d649f9d849f18676183
|
[
"Apache-2.0"
] | null | null | null |
python/examples/dataframe/concat.py
|
Sandeepa1995/cylon
|
a42d04ad9a65b20c84a15d649f9d849f18676183
|
[
"Apache-2.0"
] | null | null | null |
python/examples/dataframe/concat.py
|
Sandeepa1995/cylon
|
a42d04ad9a65b20c84a15d649f9d849f18676183
|
[
"Apache-2.0"
] | null | null | null |
import random
import pycylon as cn
from pycylon import DataFrame, CylonEnv
from pycylon.net import MPIConfig
df1 = DataFrame([random.sample(range(10, 100), 5),
random.sample(range(10, 100), 5)])
df2 = DataFrame([random.sample(range(10, 100), 5),
random.sample(range(10, 100), 5)])
df3 = DataFrame([random.sample(range(10, 100), 10),
random.sample(range(10, 100), 10)])
# local unique
df4 = cn.concat(axis=0, objs=[df1, df2, df3])
print("Local concat axis0")
print(df4)
df2.rename(['00', '11'])
df3.rename(['000', '111'])
df4 = cn.concat(axis=1, objs=[df1, df2, df3])
print("Local concat axis1")
print(df4)
# distributed unique
env = CylonEnv(config=MPIConfig())
df1 = DataFrame([random.sample(range(10 * env.rank, 15 * (env.rank + 1)), 5),
random.sample(range(10 * env.rank, 15 * (env.rank + 1)), 5)])
df2 = DataFrame([random.sample(range(10 * env.rank, 15 * (env.rank + 1)), 5),
random.sample(range(10 * env.rank, 15 * (env.rank + 1)), 5)])
df3 = DataFrame([random.sample(range(10 * env.rank, 15 * (env.rank + 1)), 10),
random.sample(range(10 * env.rank, 15 * (env.rank + 1)), 10)])
print("Distributed concat axis0", env.rank)
df4 = cn.concat(axis=0, objs=[df1, df2, df3], env=env)
print(df4)
df2.rename(['00', '11'])
df3.rename(['000', '111'])
df4 = cn.concat(axis=1, objs=[df1, df2, df3], env=env)
print("Distributed concat axis1", env.rank)
print(df4)
env.finalize()
| 32.911111
| 79
| 0.620527
| 224
| 1,481
| 4.102679
| 0.178571
| 0.106638
| 0.22198
| 0.248096
| 0.751904
| 0.751904
| 0.720348
| 0.597388
| 0.597388
| 0.534276
| 0
| 0.110744
| 0.182984
| 1,481
| 44
| 80
| 33.659091
| 0.64876
| 0.020932
| 0
| 0.352941
| 0
| 0
| 0.071873
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.117647
| 0
| 0.117647
| 0.235294
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
0a7450964abaa39434e0a3da250938f8ba82c563
| 1,711
|
py
|
Python
|
houdini/handlers/redemption/__init__.py
|
TeegxCP/houdini
|
edb55ef6094500c6a20a6827a6af9525ea2b7b36
|
[
"MIT"
] | 444
|
2020-05-30T22:28:53.000Z
|
2022-02-13T04:27:48.000Z
|
houdini/handlers/redemption/__init__.py
|
TeegxCP/houdini
|
edb55ef6094500c6a20a6827a6af9525ea2b7b36
|
[
"MIT"
] | 43
|
2020-05-18T17:40:12.000Z
|
2021-11-05T02:53:46.000Z
|
houdini/handlers/redemption/__init__.py
|
TeegxCP/houdini
|
edb55ef6094500c6a20a6827a6af9525ea2b7b36
|
[
"MIT"
] | 56
|
2020-05-20T16:31:18.000Z
|
2022-03-07T19:49:59.000Z
|
from houdini import handlers
from houdini.constants import ClientType
from houdini.data.redemption import PenguinRedemptionBook
from houdini.handlers import XTPacket
@handlers.handler(XTPacket('rjs', ext='red'), pre_login=True, client=ClientType.Vanilla)
@handlers.allow_once
async def handle_join_redemption_server_vanilla(p, credentials: str, confirmation_hash: str):
pid, _, username, login_key, rdnk, approved, rejected = credentials.split('|')
if login_key != p.login_key:
return await p.close()
async with p.server.redis.pipeline(transaction=True) as tr:
tr.setex(f'{username}.lkey', p.server.config.auth_ttl, login_key)
tr.setex(f'{username}.ckey', p.server.config.auth_ttl, confirmation_hash)
await tr.execute()
redeemed_books = await PenguinRedemptionBook.query.where(PenguinRedemptionBook.penguin_id == p.id).gino.all()
await p.send_xt('rjs', ','.join(str(redeemed_book.book_id) for redeemed_book in redeemed_books), 'houdini',
int(p.is_member))
@handlers.handler(XTPacket('rjs', ext='red'), pre_login=True, client=ClientType.Legacy)
@handlers.allow_once
async def handle_join_redemption_server_legacy(p, _, login_key: str):
if login_key != p.login_key:
return await p.close()
async with p.server.redis.pipeline(transaction=True) as tr:
tr.setex(f'{p.username}.lkey', p.server.config.auth_ttl, login_key)
await tr.execute()
redeemed_books = await PenguinRedemptionBook.query.where(PenguinRedemptionBook.penguin_id == p.id).gino.all()
await p.send_xt('rjs', ','.join(str(redeemed_book.book_id) for redeemed_book in redeemed_books), 'houdini',
int(p.is_member))
| 45.026316
| 113
| 0.726476
| 236
| 1,711
| 5.084746
| 0.309322
| 0.053333
| 0.0225
| 0.0425
| 0.741667
| 0.725
| 0.725
| 0.725
| 0.725
| 0.573333
| 0
| 0
| 0.14962
| 1,711
| 37
| 114
| 46.243243
| 0.824742
| 0
| 0
| 0.571429
| 0
| 0
| 0.047925
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.142857
| 0
| 0.214286
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
0a8f2cfaf6ea782e31029a20c99793337e716f78
| 1,748
|
py
|
Python
|
python/tvm/topi/nn/__init__.py
|
cgerum/tvm_tutorial
|
4a627ebd6b1fd9fed6feb262bb72261c94b17440
|
[
"Apache-2.0"
] | 2
|
2021-11-03T09:07:25.000Z
|
2022-02-15T01:35:46.000Z
|
python/tvm/topi/nn/__init__.py
|
cgerum/tvm_tutorial
|
4a627ebd6b1fd9fed6feb262bb72261c94b17440
|
[
"Apache-2.0"
] | 1
|
2022-03-12T01:02:46.000Z
|
2022-03-12T01:02:46.000Z
|
python/tvm/topi/nn/__init__.py
|
cgerum/tvm_tutorial
|
4a627ebd6b1fd9fed6feb262bb72261c94b17440
|
[
"Apache-2.0"
] | null | null | null |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache 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 distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# pylint: disable=wildcard-import
"""Neural network operators"""
from __future__ import absolute_import as _abs
from .conv1d import *
from .conv2d import *
from .conv3d import *
from .correlation import *
from .deformable_conv2d import *
from .depthwise_conv2d import *
from .elemwise import *
from .dilate import *
from .flatten import *
from .dense import *
from .mapping import *
from .pooling import *
from .softmax import *
from .conv3d_transpose import *
from .conv2d_transpose import *
from .conv1d_transpose import *
from .bnn import *
from .qnn import *
from .upsampling import *
from .local_response_norm import *
from .bitserial_conv1d import *
from .bitserial_conv2d import *
from .bitserial_dense import *
from .batch_matmul import *
from .sparse import *
from .pad import *
from .fifo_buffer import *
from .depth_to_space import *
from .space_to_depth import *
from .space_to_batch_nd import *
from .batch_to_space_nd import *
from .loss import *
| 32.37037
| 62
| 0.7746
| 252
| 1,748
| 5.261905
| 0.452381
| 0.233786
| 0.048265
| 0.024133
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009511
| 0.157895
| 1,748
| 53
| 63
| 32.981132
| 0.891304
| 0.463387
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
0a93fa4f9f3fe69f0bacad96f47e081f6d5ba490
| 87
|
py
|
Python
|
config.py
|
jaimin275/stock-notifier
|
e9526236c256dd13700d21cf0aa209ac442f3df1
|
[
"MIT"
] | null | null | null |
config.py
|
jaimin275/stock-notifier
|
e9526236c256dd13700d21cf0aa209ac442f3df1
|
[
"MIT"
] | null | null | null |
config.py
|
jaimin275/stock-notifier
|
e9526236c256dd13700d21cf0aa209ac442f3df1
|
[
"MIT"
] | null | null | null |
selenium = {
"chromeDriverPath": "webdrivers/chromedriver_87_0_4280_88_win32.exe"
}
| 29
| 72
| 0.781609
| 10
| 87
| 6.3
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.141026
| 0.103448
| 87
| 3
| 73
| 29
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0.704545
| 0.522727
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
0abb6f704a4cb97ce57c62312e8f0d80580c0623
| 206
|
py
|
Python
|
prodsim/_estimate_process/est_station_2.py
|
FuchsTom/ProdSim
|
1cd868de7f8f31139487eb3da4bd23800abac0e4
|
[
"MIT"
] | 2
|
2021-12-28T19:34:37.000Z
|
2022-02-23T20:35:25.000Z
|
prodsim/_estimate_process/est_station_2.py
|
FuchsTom/ProdSim
|
1cd868de7f8f31139487eb3da4bd23800abac0e4
|
[
"MIT"
] | null | null | null |
prodsim/_estimate_process/est_station_2.py
|
FuchsTom/ProdSim
|
1cd868de7f8f31139487eb3da4bd23800abac0e4
|
[
"MIT"
] | 1
|
2021-11-23T14:01:34.000Z
|
2021-11-23T14:01:34.000Z
|
def source1(env, factory):
yield env.timeout(1)
yield 1
def function1(env, item, machine, factory):
yield env.timeout(1)
def function2(env, item, machine, factory):
yield env.timeout(1)
| 17.166667
| 43
| 0.679612
| 30
| 206
| 4.666667
| 0.366667
| 0.257143
| 0.321429
| 0.471429
| 0.692857
| 0.528571
| 0.528571
| 0.528571
| 0
| 0
| 0
| 0.042424
| 0.199029
| 206
| 11
| 44
| 18.727273
| 0.806061
| 0
| 0
| 0.428571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.428571
| false
| 0
| 0
| 0
| 0.428571
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
0ac8c81e17c9fe0dd705c310da372ecd18fb9cf7
| 108
|
py
|
Python
|
admin.py
|
muhammeedsari/stream-fake-data-kafka-to-mongodb-in-python
|
218d64b28d97e9f4fd20aca721cc8adbfd8ef6cf
|
[
"MIT"
] | null | null | null |
admin.py
|
muhammeedsari/stream-fake-data-kafka-to-mongodb-in-python
|
218d64b28d97e9f4fd20aca721cc8adbfd8ef6cf
|
[
"MIT"
] | null | null | null |
admin.py
|
muhammeedsari/stream-fake-data-kafka-to-mongodb-in-python
|
218d64b28d97e9f4fd20aca721cc8adbfd8ef6cf
|
[
"MIT"
] | null | null | null |
from app.controllers.admin_controller import AdminController
admin = AdminController()
admin.create_topic()
| 27
| 60
| 0.851852
| 12
| 108
| 7.5
| 0.75
| 0.444444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.074074
| 108
| 4
| 61
| 27
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
0ad4da4b0a61358f41c82c902decfeee1e6fc209
| 98
|
py
|
Python
|
tests/test_discord_rebot.py
|
nkpro2000sr/discord-rebot
|
615c4ec74bdbd6db53c63798cdfe9c041e446ebe
|
[
"MIT"
] | null | null | null |
tests/test_discord_rebot.py
|
nkpro2000sr/discord-rebot
|
615c4ec74bdbd6db53c63798cdfe9c041e446ebe
|
[
"MIT"
] | null | null | null |
tests/test_discord_rebot.py
|
nkpro2000sr/discord-rebot
|
615c4ec74bdbd6db53c63798cdfe9c041e446ebe
|
[
"MIT"
] | null | null | null |
import pytest
rebot = pytest.rebot
def test_version():
assert rebot.__version__ == "0.0.2"
| 12.25
| 39
| 0.693878
| 14
| 98
| 4.5
| 0.642857
| 0.349206
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0375
| 0.183673
| 98
| 7
| 40
| 14
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0.05102
| 0
| 0
| 0
| 0
| 0
| 0.25
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
0af7ed2775c3a756e241e6a4afa9088cd22b2366
| 391
|
py
|
Python
|
pykambpf/__init__.py
|
zdule/part_ii_project
|
4c7e49408e1453772f3bc13d049c8703d79d0129
|
[
"Apache-2.0"
] | null | null | null |
pykambpf/__init__.py
|
zdule/part_ii_project
|
4c7e49408e1453772f3bc13d049c8703d79d0129
|
[
"Apache-2.0"
] | null | null | null |
pykambpf/__init__.py
|
zdule/part_ii_project
|
4c7e49408e1453772f3bc13d049c8703d79d0129
|
[
"Apache-2.0"
] | null | null | null |
# This file is part of the kambpf project (https://github.com/zdule/part_ii_project).
# It is file is offered under two licenses GPLv2 and Apache License Version 2.
# For more information see the LICENSE file at the root of the project.
#
# Copyright 2020 Dusan Zivanovic
from .libkambpf import UpdatesBuffer, KambpfList
from .call_graph import CallGraph
from . import dummy_probes
| 39.1
| 87
| 0.777494
| 60
| 391
| 5
| 0.733333
| 0.04
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.018519
| 0.171356
| 391
| 9
| 88
| 43.444444
| 0.907407
| 0.682864
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
7c3af2de9f1c931e04f0410d55310002f3b44c84
| 140
|
py
|
Python
|
torch_chemistry/nn/__init__.py
|
0h-n0/pytorch_chemistry
|
14ca01ab2a30728016ce6c6793f119438a09ade5
|
[
"MIT"
] | 7
|
2019-12-21T12:36:20.000Z
|
2022-01-15T11:05:25.000Z
|
torch_chemistry/nn/__init__.py
|
0h-n0/pytorch-chemistry
|
14ca01ab2a30728016ce6c6793f119438a09ade5
|
[
"MIT"
] | null | null | null |
torch_chemistry/nn/__init__.py
|
0h-n0/pytorch-chemistry
|
14ca01ab2a30728016ce6c6793f119438a09ade5
|
[
"MIT"
] | 1
|
2020-11-05T09:33:18.000Z
|
2020-11-05T09:33:18.000Z
|
from .metrics.masked_binary_cross_entropy import (MaksedBCELoss,
MaskedBCEWithLogitsLoss)
| 46.666667
| 74
| 0.571429
| 9
| 140
| 8.555556
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.392857
| 140
| 2
| 75
| 70
| 0.905882
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
7cbd0e3ebac0fbf8e309283322cc2dce87eba436
| 258
|
py
|
Python
|
exercicios_basico/ex108/moeda.py
|
montalvas/python
|
483c2097f6f91bfae127dafcb63e3006eeecad1d
|
[
"MIT"
] | null | null | null |
exercicios_basico/ex108/moeda.py
|
montalvas/python
|
483c2097f6f91bfae127dafcb63e3006eeecad1d
|
[
"MIT"
] | null | null | null |
exercicios_basico/ex108/moeda.py
|
montalvas/python
|
483c2097f6f91bfae127dafcb63e3006eeecad1d
|
[
"MIT"
] | null | null | null |
def metade(n):
return n / 2
def dobro(n):
return n * 2
def aumentar(n, p):
r = 1 + (p / 100)
return n * r
def diminuir(n, p):
r = 1 - (p / 100)
return n * r
def moeda(p):
res = str(p).replace('.', ',') + '0'
return res
| 12.285714
| 40
| 0.472868
| 44
| 258
| 2.772727
| 0.386364
| 0.229508
| 0.131148
| 0.147541
| 0.508197
| 0.311475
| 0.311475
| 0.311475
| 0.311475
| 0.311475
| 0
| 0.065089
| 0.344961
| 258
| 21
| 41
| 12.285714
| 0.656805
| 0
| 0
| 0.153846
| 0
| 0
| 0.011583
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.384615
| false
| 0
| 0
| 0.153846
| 0.769231
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
6b18b71b4ecb1444ba3d0b56264e761db4de4f62
| 191
|
py
|
Python
|
django/django_connect.py
|
AllenNeuralDynamics/ephys-framework-tests
|
ee940afeab54e5e25765a903a6b65f2e95be4c48
|
[
"MIT"
] | null | null | null |
django/django_connect.py
|
AllenNeuralDynamics/ephys-framework-tests
|
ee940afeab54e5e25765a903a6b65f2e95be4c48
|
[
"MIT"
] | 3
|
2022-01-22T04:34:46.000Z
|
2022-01-26T02:14:21.000Z
|
django/django_connect.py
|
AllenNeuralDynamics/ephys-framework-tests
|
ee940afeab54e5e25765a903a6b65f2e95be4c48
|
[
"MIT"
] | 2
|
2022-01-21T22:38:27.000Z
|
2022-01-25T01:30:09.000Z
|
def connect():
import sys
sys.dont_write_bytecode = True
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
import django
django.setup()
| 17.363636
| 63
| 0.65445
| 22
| 191
| 5.5
| 0.681818
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.256545
| 191
| 10
| 64
| 19.1
| 0.852113
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 0.115789
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| true
| 0
| 0.428571
| 0
| 0.571429
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6b2468da15dc618ecedf227c97e581a3b34eeb87
| 74,279
|
py
|
Python
|
generate-grammars/python-awk/python2_test.py
|
mbaak/histogrammar-python
|
6311f5b0eec9c75f12018f22604535c64675fdf6
|
[
"Apache-2.0"
] | 30
|
2016-09-25T16:36:06.000Z
|
2021-07-20T09:09:09.000Z
|
generate-grammars/python-awk/python2_test.py
|
mbaak/histogrammar-python
|
6311f5b0eec9c75f12018f22604535c64675fdf6
|
[
"Apache-2.0"
] | 15
|
2016-07-26T19:41:31.000Z
|
2021-02-07T16:30:11.000Z
|
generate-grammars/python-awk/python2_test.py
|
mbaak/histogrammar-python
|
6311f5b0eec9c75f12018f22604535c64675fdf6
|
[
"Apache-2.0"
] | 8
|
2016-09-19T20:48:37.000Z
|
2021-02-07T15:00:24.000Z
|
#!/usr/bin/env python
import ast
import sys
import re
import glob
import histogrammar.hgawk_grammar as grammar
def check(source, fileName=None):
theirs = ast.parse(source)
theirsdump = ast.dump(theirs)
theirsres = {}
if fileName is None:
try:
exec compile(theirs, "<check>", "exec") in theirsres
except Exception as err:
theirsres = err
else:
for key in theirsres.keys():
if callable(theirsres[key]):
del theirsres[key]
if fileName is None:
print >> sys.stderr, "test: ", source
else:
print >> sys.stderr, "test: ", fileName
mine = grammar.parse(source)
mineres = {}
try:
minedump = ast.dump(mine)
except Exception as err:
minedump = err
else:
if fileName is None:
try:
exec compile(mine, "<check>", "exec") in mineres
except Exception as err:
mineres = err
else:
for key in mineres.keys():
if callable(mineres[key]):
del mineres[key]
# verify that the dump is the same
if minedump == theirsdump and \
((isinstance(mineres, Exception) and isinstance(theirsres, Exception) and str(mineres) == str(theirsres)) or \
(isinstance(mineres, dict) and isinstance(theirsres, dict) and mineres == theirsres)):
pass
else:
print >> sys.stderr, "my dump: ", minedump
print >> sys.stderr, "their dump: ", theirsdump
if isinstance(mineres, Exception):
print >> sys.stderr, "my except: ", str(mineres)
if isinstance(theirsres, Exception):
print >> sys.stderr, "their except:", str(theirsres)
if not isinstance(mineres, Exception) and not isinstance(theirsres, Exception):
t = {}
m = {}
for key in theirsres:
if key not in mineres:
t[key] = theirsres[key]
elif mineres[key] != theirsres[key]:
m[key] = mineres[key]
t[key] = theirsres[key]
for key in mineres:
if key not in theirsres:
m[key] = mineres[key]
print >> sys.stderr, "my result: ", m
print >> sys.stderr, "their result:", m
print >> sys.stderr
sys.exit(-1)
# verify that even the line numbers are the same
global same, treeOne, treeTwo
same = True
treeOne = ""
treeTwo = ""
def deepcompare(one, two, indent):
global same, treeOne, treeTwo
if isinstance(one, ast.AST):
if not (isinstance(two, ast.AST) and one._fields == two._fields and one.__class__ == two.__class__):
same = False
if not (getattr(one, "lineno", "?") == getattr(two, "lineno", "?") and getattr(one, "col_offset", "?") == getattr(two, "col_offset", "?")):
if hasattr(one, "lineno") and hasattr(one, "col_offset"):
# Python's lineno/col_offset for strings with line breaks is wrong.
# Don't count it against my implementation for getting it right.
if not isinstance(one, ast.Str) and not (isinstance(one, ast.Expr) and isinstance(one.value, ast.Str)):
same = False
if not (hasattr(two, "lineno") and hasattr(two, "col_offset")):
raise Exception
treeOne += one.__class__.__name__ + " " + str(getattr(one, "lineno", "?")) + ":" + str(getattr(one, "col_offset", "?")) + "\n"
treeTwo += two.__class__.__name__ + " " + str(getattr(two, "lineno", "?")) + ":" + str(getattr(two, "col_offset", "?")) + " (" + str(getattr(two, "rule", "???")) + ")\n"
for attrib in one._fields:
treeOne += indent + " " + attrib + ": "
treeTwo += indent + " " + attrib + ": "
valueOne = getattr(one, attrib)
valueTwo = getattr(two, attrib)
if isinstance(valueOne, list):
if not (isinstance(valueTwo, list) and len(valueOne) == len(valueTwo)):
same = False
if len(valueOne) == 0:
treeOne += "[]\n"
else:
treeOne += "\n"
if len(valueTwo) == 0:
treeTwo += "[]\n"
else:
treeTwo += "\n"
for x, y in zip(valueOne, valueTwo):
treeOne += indent + " - "
treeTwo += indent + " - "
deepcompare(x, y, indent + " ")
elif isinstance(valueOne, (ast.Load, ast.Store, ast.Param, ast.Del)):
if not (isinstance(valueTwo, (ast.Load, ast.Store, ast.Param, ast.Del))):
same = False
treeOne += valueOne.__class__.__name__ + "\n"
treeTwo += valueTwo.__class__.__name__ + "\n"
elif isinstance(valueOne, ast.AST):
if not (isinstance(valueTwo, ast.AST)):
same = False
deepcompare(valueOne, valueTwo, indent + " ")
elif valueOne is None or isinstance(valueOne, (int, long, float, complex, basestring)):
if not (valueOne == valueTwo):
same = False
treeOne += repr(valueOne) + "\n"
treeTwo += repr(valueTwo) + "\n"
else:
raise Exception
else:
if not (one == two):
same = False
if fileName is not None:
return
deepcompare(theirs, mine, "")
if not same:
print >> sys.stderr, source
print >> sys.stderr
treeOne = treeOne.split("\n")
treeTwo = treeTwo.split("\n")
width = max(len(x) for x in treeOne) + 3
while len(treeOne) < len(treeTwo):
treeOne.append("")
while len(treeTwo) < len(treeOne):
treeTwo.append("")
for x, y in zip(treeOne, treeTwo):
diff = x != re.sub("\s*\(.*\)", "", y)
while len(x) < width:
x += " "
if diff:
print >> sys.stderr, x + "| " + y
else:
print >> sys.stderr, x + " " + y
sys.exit(-1)
if __name__ == "__main__":
sys.stdout = open("/dev/null", "wb")
check('''3 <> 4''')
check('''.3''')
check('''-3''')
check('''- 3''')
check('''- 3''')
check('''--3''')
check('''-- 3''')
check('''- -3''')
check('''- - 3''')
check('''- - 3''')
check('''+3''')
check('''+ 3''')
check('''+ 3''')
check('''++3''')
check('''++ 3''')
check('''+ +3''')
check('''+ + 3''')
check('''+ + 3''')
check('''+-3''')
check('''+- 3''')
check('''+ -3''')
check('''+ - 3''')
check('''+ - 3''')
check('''-+3''')
check('''-+ 3''')
check('''- +3''')
check('''- + 3''')
check('''- + 3''')
check('''-3.14''')
check('''- 3.14''')
check('''- 3.14''')
check('''--3.14''')
check('''-- 3.14''')
check('''- -3.14''')
check('''- - 3.14''')
check('''- - 3.14''')
check('''+3.14''')
check('''+ 3.14''')
check('''+ 3.14''')
check('''++3.14''')
check('''++ 3.14''')
check('''+ +3.14''')
check('''+ + 3.14''')
check('''+ + 3.14''')
check('''+-3.14''')
check('''+- 3.14''')
check('''+ -3.14''')
check('''+ - 3.14''')
check('''+ - 3.14''')
check('''-+3.14''')
check('''-+ 3.14''')
check('''- +3.14''')
check('''- + 3.14''')
check('''- + 3.14''')
check('''-3e1''')
check('''- 3e1''')
check('''- 3e1''')
check('''--3e1''')
check('''-- 3e1''')
check('''- -3e1''')
check('''- - 3e1''')
check('''- - 3e1''')
check('''+3e1''')
check('''+ 3e1''')
check('''+ 3e1''')
check('''++3e1''')
check('''++ 3e1''')
check('''+ +3e1''')
check('''+ + 3e1''')
check('''+ + 3e1''')
check('''+-3e1''')
check('''+- 3e1''')
check('''+ -3e1''')
check('''+ - 3e1''')
check('''+ - 3e1''')
check('''-+3e1''')
check('''-+ 3e1''')
check('''- +3e1''')
check('''- + 3e1''')
check('''- + 3e1''')
check('''3''')
check('''3,''')
check('''3, 4''')
check('''3, 4,''')
check('''3, 4, 5''')
check('''3, 4, 5,''')
check('''3, 4, 5, 6''')
check('''3, 4, 5, 6,''')
check('''()''')
check('''(3)''')
check('''(3,)''')
check('''(3, 4)''')
check('''(3, 4,)''')
check('''(3, 4, 5)''')
check('''(3, 4, 5,)''')
check('''(3, 4, 5, 6)''')
check('''(3, 4, 5, 6,)''')
check('''(),''')
check('''(3),''')
check('''(3,),''')
check('''(3, 4),''')
check('''(3, 4,),''')
check('''(3, 4, 5),''')
check('''(3, 4, 5,),''')
check('''(3, 4, 5, 6),''')
check('''(3, 4, 5, 6,),''')
check('''((1), 2, 3, 4, 5)''')
check('''((1, 2), 3, 4, 5)''')
check('''((1, 2, 3), 4, 5)''')
check('''((1, 2, 3, 4), 5)''')
check('''((1, 2, 3, 4, 5))''')
check('''(((1), 2, 3, 4, 5))''')
check('''(((1, 2), 3, 4, 5))''')
check('''(((1, 2, 3), 4, 5))''')
check('''(((1, 2, 3, 4), 5))''')
check('''(((1, 2, 3, 4, 5)))''')
check('''(1, 2, 3, 4, (5))''')
check('''(1, 2, 3, (4, 5))''')
check('''(1, 2, (3, 4, 5))''')
check('''(1, (2, 3, 4, 5))''')
check('''((1, 2, 3, 4, (5)))''')
check('''((1, 2, 3, (4, 5)))''')
check('''((1, 2, (3, 4, 5)))''')
check('''((1, (2, 3, 4, 5)))''')
check('''[]''')
check('''[3]''')
check('''[3,]''')
check('''[3, 4]''')
check('''[3, 4,]''')
check('''[3, 4, 5]''')
check('''[3, 4, 5,]''')
check('''[3, 4, 5, 6]''')
check('''[3, 4, 5, 6,]''')
check('''[],''')
check('''[3],''')
check('''[3,],''')
check('''[3, 4],''')
check('''[3, 4,],''')
check('''[3, 4, 5],''')
check('''[3, 4, 5,],''')
check('''[3, 4, 5, 6],''')
check('''[3, 4, 5, 6,],''')
check('''[[1], 2, 3, 4, 5]''')
check('''[[1, 2], 3, 4, 5]''')
check('''[[1, 2, 3], 4, 5]''')
check('''[[1, 2, 3, 4], 5]''')
check('''[[1, 2, 3, 4, 5]]''')
check('''[[[1], 2, 3, 4, 5]]''')
check('''[[[1, 2], 3, 4, 5]]''')
check('''[[[1, 2, 3], 4, 5]]''')
check('''[[[1, 2, 3, 4], 5]]''')
check('''[[[1, 2, 3, 4, 5]]]''')
check('''[1, 2, 3, 4, [5]]''')
check('''[1, 2, 3, [4, 5]]''')
check('''[1, 2, [3, 4, 5]]''')
check('''[1, [2, 3, 4, 5]]''')
check('''[[1, 2, 3, 4, [5]]]''')
check('''[[1, 2, 3, [4, 5]]]''')
check('''[[1, 2, [3, 4, 5]]]''')
check('''[[1, [2, 3, 4, 5]]]''')
check('''[(1), 2, 3, 4, 5]''')
check('''[(1, 2), 3, 4, 5]''')
check('''[(1, 2, 3), 4, 5]''')
check('''[(1, 2, 3, 4), 5]''')
check('''[(1, 2, 3, 4, 5)]''')
check('''[([1], 2, 3, 4, 5)]''')
check('''[([1, 2], 3, 4, 5)]''')
check('''[([1, 2, 3], 4, 5)]''')
check('''[([1, 2, 3, 4], 5)]''')
check('''[([1, 2, 3, 4, 5])]''')
check('''[1, 2, 3, 4, (5)]''')
check('''[1, 2, 3, (4, 5)]''')
check('''[1, 2, (3, 4, 5)]''')
check('''[1, (2, 3, 4, 5)]''')
check('''[(1, 2, 3, 4, [5])]''')
check('''[(1, 2, 3, [4, 5])]''')
check('''[(1, 2, [3, 4, 5])]''')
check('''[(1, [2, 3, 4, 5])]''')
check('''([1], 2, 3, 4, 5)''')
check('''([1, 2], 3, 4, 5)''')
check('''([1, 2, 3], 4, 5)''')
check('''([1, 2, 3, 4], 5)''')
check('''([1, 2, 3, 4, 5])''')
check('''([(1), 2, 3, 4, 5])''')
check('''([(1, 2), 3, 4, 5])''')
check('''([(1, 2, 3), 4, 5])''')
check('''([(1, 2, 3, 4), 5])''')
check('''([(1, 2, 3, 4, 5)])''')
check('''(1, 2, 3, 4, [5])''')
check('''(1, 2, 3, [4, 5])''')
check('''(1, 2, [3, 4, 5])''')
check('''(1, [2, 3, 4, 5])''')
check('''([1, 2, 3, 4, (5)])''')
check('''([1, 2, 3, (4, 5)])''')
check('''([1, 2, (3, 4, 5)])''')
check('''([1, (2, 3, 4, 5)])''')
check('''{}''')
check('''{3}''')
check('''{3,}''')
check('''{3, 4}''')
check('''{3, 4,}''')
check('''{3, 4, 5}''')
check('''{3, 4, 5,}''')
check('''{3, 4, 5, 6}''')
check('''{3, 4, 5, 6,}''')
check('''{},''')
check('''{3},''')
check('''{3,},''')
check('''{3, 4},''')
check('''{3, 4,},''')
check('''{3, 4, 5},''')
check('''{3, 4, 5,},''')
check('''{3, 4, 5, 6},''')
check('''{3, 4, 5, 6,},''')
check('''{{1}, 2, 3, 4, 5}''')
check('''{{1, 2}, 3, 4, 5}''')
check('''{{1, 2, 3}, 4, 5}''')
check('''{{1, 2, 3, 4}, 5}''')
check('''{{1, 2, 3, 4, 5}}''')
check('''{{{1}, 2, 3, 4, 5}}''')
check('''{{{1, 2}, 3, 4, 5}}''')
check('''{{{1, 2, 3}, 4, 5}}''')
check('''{{{1, 2, 3, 4}, 5}}''')
check('''{{{1, 2, 3, 4, 5}}}''')
check('''{1, 2, 3, 4, {5}}''')
check('''{1, 2, 3, {4, 5}}''')
check('''{1, 2, {3, 4, 5}}''')
check('''{1, {2, 3, 4, 5}}''')
check('''{{1, 2, 3, 4, {5}}}''')
check('''{{1, 2, 3, {4, 5}}}''')
check('''{{1, 2, {3, 4, 5}}}''')
check('''{{1, {2, 3, 4, 5}}}''')
check('''{(1), 2, 3, 4, 5}''')
check('''{(1, 2), 3, 4, 5}''')
check('''{(1, 2, 3), 4, 5}''')
check('''{(1, 2, 3, 4), 5}''')
check('''{(1, 2, 3, 4, 5)}''')
check('''{({1}, 2, 3, 4, 5)}''')
check('''{({1, 2}, 3, 4, 5)}''')
check('''{({1, 2, 3}, 4, 5)}''')
check('''{({1, 2, 3, 4}, 5)}''')
check('''{({1, 2, 3, 4, 5})}''')
check('''{1, 2, 3, 4, (5)}''')
check('''{1, 2, 3, (4, 5)}''')
check('''{1, 2, (3, 4, 5)}''')
check('''{1, (2, 3, 4, 5)}''')
check('''{(1, 2, 3, 4, {5})}''')
check('''{(1, 2, 3, {4, 5})}''')
check('''{(1, 2, {3, 4, 5})}''')
check('''{(1, {2, 3, 4, 5})}''')
check('''({1}, 2, 3, 4, 5)''')
check('''({1, 2}, 3, 4, 5)''')
check('''({1, 2, 3}, 4, 5)''')
check('''({1, 2, 3, 4}, 5)''')
check('''({1, 2, 3, 4, 5})''')
check('''({(1), 2, 3, 4, 5})''')
check('''({(1, 2), 3, 4, 5})''')
check('''({(1, 2, 3), 4, 5})''')
check('''({(1, 2, 3, 4), 5})''')
check('''({(1, 2, 3, 4, 5)})''')
check('''(1, 2, 3, 4, {5})''')
check('''(1, 2, 3, {4, 5})''')
check('''(1, 2, {3, 4, 5})''')
check('''(1, {2, 3, 4, 5})''')
check('''({1, 2, 3, 4, (5)})''')
check('''({1, 2, 3, (4, 5)})''')
check('''({1, 2, (3, 4, 5)})''')
check('''({1, (2, 3, 4, 5)})''')
check('''{a: 3}''')
check('''{a: 3,}''')
check('''{a: 3, b: 4}''')
check('''{a: 3, b: 4,}''')
check('''{a: 3, b: 4, c: 5}''')
check('''{a: 3, b: 4, c: 5,}''')
check('''{a: 3, b: 4, c: 5, d: 6}''')
check('''{a: 3, b: 4, c: 5, d: 6,}''')
check('''{a: 3},''')
check('''{a: 3,},''')
check('''{a: 3, b: 4},''')
check('''{a: 3, b: 4,},''')
check('''{a: 3, b: 4, c: 5},''')
check('''{a: 3, b: 4, c: 5,},''')
check('''{a: 3, b: 4, c: 5, d: 6},''')
check('''{a: 3, b: 4, c: 5, d: 6,},''')
check('''{{x: 1}, 2, 3, 4, 5}''')
check('''{{x: 1, y: 2}, 3, 4, 5}''')
check('''{{x: 1, y: 2, a: 3}, 4, 5}''')
check('''{{x: 1, y: 2, a: 3, b: 4}, 5}''')
check('''{{x: 1, y: 2, a: 3, b: 4, c: 5}}''')
check('''{{{x: 1}, 2, 3, 4, 5}}''')
check('''{{{x: 1, y: 2}, 3, 4, 5}}''')
check('''{{{x: 1, y: 2, a: 3}, 4, 5}}''')
check('''{{{x: 1, y: 2, a: 3, b: 4}, 5}}''')
check('''{{{x: 1, y: 2, a: 3, b: 4, c: 5}}}''')
check('''{1, 2, 3, 4, {c: 5}}''')
check('''{1, 2, 3, {b: 4, c: 5}}''')
check('''{1, 2, {a: 3, b: 4, c: 5}}''')
check('''{1, {y: 2, a: 3, b: 4, c: 5}}''')
check('''{{1, 2, 3, 4, {c: 5}}}''')
check('''{{1, 2, 3, {b: 4, c: 5}}}''')
check('''{{1, 2, {a: 3, b: 4, c: 5}}}''')
check('''{{1, {y: 2, a: 3, b: 4, c: 5}}}''')
check('''{x: (1), y: 2, a: 3, b: 4, c: 5}''')
check('''{x: (1, 2), a: 3, b: 4, c: 5}''')
check('''{x: (1, 2, 3), b: 4, c: 5}''')
check('''{x: (1, 2, 3, 4), c: 5}''')
check('''{x: (1, 2, 3, 4, 5)}''')
check('''{({x: 1}, 2, 3, 4, 5)}''')
check('''{({x: 1, y: 2}, 3, 4, 5)}''')
check('''{({x: 1, y: 2, a: 3}, 4, 5)}''')
check('''{({x: 1, y: 2, a: 3, b: 4}, 5)}''')
check('''{({x: 1, y: 2, a: 3, b: 4, c: 5})}''')
check('''{x: 1, y: 2, a: 3, b: 4, c: (5)}''')
check('''{x: 1, y: 2, a: 3, b: (4, 5)}''')
check('''{x: 1, y: 2, a: (3, 4, 5)}''')
check('''{x: 1, y: (2, 3, 4, 5)}''')
check('''{(1, 2, 3, 4, {c: 5})}''')
check('''{(1, 2, 3, {b: 4, c: 5})}''')
check('''{(1, 2, {a: 3, b: 4, c: 5})}''')
check('''{(1, {y: 2, a: 3, b: 4, c: 5})}''')
check('''({x: 1}, 2, 3, 4, 5)''')
check('''({x: 1, y: 2}, 3, 4, 5)''')
check('''({x: 1, y: 2, a: 3}, 4, 5)''')
check('''({x: 1, y: 2, a: 3, b: 4}, 5)''')
check('''({x: 1, y: 2, a: 3, b: 4, c: 5})''')
check('''({x: (1), y: 2, a: 3, b: 4, c: 5})''')
check('''({x: (1, 2), a: 3, b: 4, c: 5})''')
check('''({x: (1, 2, 3), b: 4, c: 5})''')
check('''({x: (1, 2, 3, 4), c: 5})''')
check('''({x: (1, 2, 3, 4, 5)})''')
check('''(1, 2, 3, 4, {c: 5})''')
check('''(1, 2, 3, {b: 4, c: 5})''')
check('''(1, 2, {a: 3, b: 4, c: 5})''')
check('''(1, {y: 2, a: 3, b: 4, c: 5})''')
check('''({x: 1, y: 2, a: 3, b: (4, 5)})''')
check('''({x: 1, y: 2, a: (3, 4, 5)})''')
check('''({x: 1, y: (2, 3, 4, 5)})''')
check('''a = 3''')
check('''a, = 3,''')
check('''a, b = 3, 4''')
check('''a, b, = 3, 4,''')
check('''a, b, c = 3, 4, 5''')
check('''a, b, c, = 3, 4, 5,''')
check('''a, b, c, d = 3, 4, 5, 6''')
check('''a, b, c, d, = 3, 4, 5, 6,''')
check('''z = a = 3''')
check('''z = a, = 3,''')
check('''z = a, b = 3, 4''')
check('''z = a, b, = 3, 4,''')
check('''z = a, b, c = 3, 4, 5''')
check('''z = a, b, c, = 3, 4, 5,''')
check('''z = a, b, c, d = 3, 4, 5, 6''')
check('''z = a, b, c, d, = 3, 4, 5, 6,''')
check('''a = (b, c) = (d, [e, f]) = [1, (2, 3)]''')
check('''a = (b, c,) = (d, [e, f]) = [1, (2, 3)]''')
check('''a = b, c, = (d, [e, f]) = [1, (2, 3)]''')
check('''a, = b, c, = (d, [e, f]) = [1, (2, 3)]''')
check('''a = b, c, = d, [e, f] = [1, (2, 3)]''')
check('''a = b, c, z = d, [e, f] = [1, (2, 3)]''')
check('''a = (b, c) = (d, [e, f]) = [1, (2, 3,)]''')
check('''a = (b, c,) = (d, [e, f]) = [1, (2, 3),]''')
check('''a = b, c, = (d, [e, f]) = [1, (2, 3)],''')
check('''a, = b, c, = (d, [e, f]) = [(2, 3), 1]''')
check('''a = b, c, = d, [e, f] = [(2, 3), 1,]''')
check('''a = b, c, z = d, [e, f] = [(2, 3), 1, ()]''')
check('''''')
check('''
''')
check('''
''')
check('''3
''')
check('''3
''')
check('''3
''')
check('''3
''')
check('''
3''')
check('''
3''')
check('''
3''')
check('''
3''')
check('''x = 3
''')
check('''x = 3
''')
check('''x = 3
''')
check('''x = 3
''')
check('''
x = 3''')
check('''
x = 3''')
check('''
x = 3''')
check('''
x = 3''')
check('''x; y''')
check('''x; y; z''')
check('''x; y; z; w''')
check('''x
y''')
check('''x
y
z''')
check('''x
y
z
w''')
check('''x
y
z
w''')
check('''x; y
z
w''')
check('''x
y
z
w;''')
check('''x;
y;
z;
w;''')
check('''x; y;
z;
w;''')
check('''x; y;
z;
w''')
check('''if x: y''')
check('''if x:
y''')
check('''if x:
y''')
check('''if x:
y
''')
check('''if x:
y
''')
check('''
if x:
y''')
check('''if x:
y;''')
check('''if x:
y;
''')
check('''if x:
y
z
''')
check('''if x:
y
z
w
''')
check('''if x:
y;
z
w
''')
check('''if x:
y
z;
w
''')
check('''if x:
y
z
w;
''')
check('''if x:
if y:
z
w
''')
check('''if x:
if y:
z
w
u
''')
check('''if x:
xx
if y:
z
w
u
''')
check('''if x:
xx;
if y:
z
w
u
''')
check('''if x:
xx
if y:
z;
w
u
''')
check('''if x:
xx
if y:
z
w;
u
''')
check('''if x:
y
else:
z''')
check('''if x: y
else: z''')
check('''if x:
if y:
w
else:
z''')
check('''if x:
if y:
w
ww
else:
z''')
check('''if x:
uu
if y:
w
ww
else:
z''')
check('''if x:
y
else:
if z:
w''')
check('''if x:
y
else:
if z:
w''')
check('''if x:
y
else:
if z:
w
else:
u''')
check('''if x:
y
elif z:
w''')
check('''if x:
y
elif z:
w
else:
u''')
check('''if x:
y
elif z:
w
elif u:
a''')
check('''if x:
y
elif z:
w
elif u:
a
else:
b''')
check('''if x:
y
elif z:
w
elif u:
a
elif b:
c''')
check('''if x:
y
elif z:
w
elif u:
a
elif b:
c
else:
d''')
check('''while x: y''')
check('''while x:
y''')
check('''while x:
y
else:
z''')
check('''for x in 1, 2, 3:
z''')
check('''for x, in 1, 2, 3:
z''')
check('''for x, y in 1, 2, 3:
z''')
check('''for x, y, in 1, 2, 3:
z''')
check('''for x, y, z in 1, 2, 3:
z''')
check('''for x, y, z, in 1, 2, 3:
z''')
check('''for x in 1, 2, 3:
z
else:
w''')
check('''try:
x
except:
y''')
check('''try:
x
except A:
y''')
check('''try:
x
except A as a:
y''')
check('''try:
x
except A, a:
y''')
check('''try:
x
except A:
y
except B:
z''')
check('''try:
x
except A as a:
y
except B as b:
z''')
check('''try:
x
except A, a:
y
except B, b:
z''')
check('''try:
x
except:
y
else:
z''')
check('''try:
x
except A:
y
else:
z''')
check('''try:
x
except A as a:
y
else:
z''')
check('''try:
x
except A, a:
y
else:
z''')
check('''try:
x
finally:
z''')
check('''try:
x
except:
y
finally:
z''')
check('''try:
x
except A:
y
finally:
z''')
check('''try:
x
except A as a:
y
finally:
z''')
check('''try:
x
except A, a:
y
finally:
z''')
check('''try:
x
except:
y
else:
yy
finally:
z''')
check('''try:
x
except A:
y
else:
yy
finally:
z''')
check('''try:
x
except A as a:
y
else:
yy
finally:
z''')
check('''try:
x
except A, a:
y
else:
yy
finally:
z''')
check('''with a: b''')
check('''with a, b: c''')
check('''with a, b, c: d''')
check('''with a, b, c, d: e''')
check('''with a as aa: b''')
check('''with a as aa, b as bb: c''')
check('''with a as aa, b as bb, c as cc: d''')
check('''with a as aa, b as bb, c as cc, d as dd: e''')
check('''def f(): 3''')
check('''def f(x): 3''')
check('''def f(x,): 3''')
check('''def f(x, y): 3''')
check('''def f(x, y,): 3''')
check('''def f(x, y, z): 3''')
check('''def f(x, y, z, w): 3''')
check('''def f(x = 1): 3''')
check('''def f(x = 1,): 3''')
check('''def f(x, y = 2): 3''')
check('''def f(x, y = 2,): 3''')
check('''def f(x = 1, y = 2): 3''')
check('''def f(x = 1, y = 2,): 3''')
check('''def f(x = 1, y = 2, z = 3): 3''')
check('''def f(x, y = 2, z = 3): 3''')
check('''def f(x, y, z = 3): 3''')
check('''def f(*args): 3''')
check('''def f(x, *args): 3''')
check('''def f(x, y, *args): 3''')
check('''def f(x, y, z, *args): 3''')
check('''def f(x, y, z, w, *args): 3''')
check('''def f(x = 1, *args): 3''')
check('''def f(x, y = 2, *args): 3''')
check('''def f(x = 1, y = 2, *args): 3''')
check('''def f(x = 1, y = 2, z = 3, *args): 3''')
check('''def f(x, y = 2, z = 3, *args): 3''')
check('''def f(x, y, z = 3, *args): 3''')
check('''def f(**kwds): 3''')
check('''def f(x, **kwds): 3''')
check('''def f(x, y, **kwds): 3''')
check('''def f(x, y, z, **kwds): 3''')
check('''def f(x, y, z, w, **kwds): 3''')
check('''def f(x = 1, **kwds): 3''')
check('''def f(x, y = 2, **kwds): 3''')
check('''def f(x = 1, y = 2, **kwds): 3''')
check('''def f(x = 1, y = 2, z = 3, **kwds): 3''')
check('''def f(x, y = 2, z = 3, **kwds): 3''')
check('''def f(x, y, z = 3, **kwds): 3''')
check('''def f(*args, **kwds): 3''')
check('''def f(x, *args, **kwds): 3''')
check('''def f(x, y, *args, **kwds): 3''')
check('''def f(x, y, z, *args, **kwds): 3''')
check('''def f(x, y, z, w, *args, **kwds): 3''')
check('''def f(x = 1, *args, **kwds): 3''')
check('''def f(x, y = 2, *args, **kwds): 3''')
check('''def f(x = 1, y = 2, *args, **kwds): 3''')
check('''def f(x = 1, y = 2, z = 3, *args, **kwds): 3''')
check('''def f(x, y = 2, z = 3, *args, **kwds): 3''')
check('''def f(x, y, z = 3, *args, **kwds): 3''')
check('''def f((a)): 3''')
check('''def f((a,)): 3''')
check('''def f((a, b)): 3''')
check('''def f((a, b,)): 3''')
check('''def f((a, b, c)): 3''')
check('''def f((a, b, c, d)): 3''')
check('''def f((a),): 3''')
check('''def f((a,),): 3''')
check('''def f((a, b),): 3''')
check('''def f((a, b,),): 3''')
check('''def f((a, b, c),): 3''')
check('''def f((a, b, c, d),): 3''')
check('''def f(x, (a)): 3''')
check('''def f(x, (a,)): 3''')
check('''def f(x, (a, b)): 3''')
check('''def f(x, (a, b,)): 3''')
check('''def f(x, (a, b, c)): 3''')
check('''def f(x, (a, b, c, d)): 3''')
check('''def f(x, (a),): 3''')
check('''def f(x, (a,),): 3''')
check('''def f(x, (a, b),): 3''')
check('''def f(x, (a, b,),): 3''')
check('''def f(x, (a, b, c),): 3''')
check('''def f(x, (a, b, c, d),): 3''')
check('''def f((a), x): 3''')
check('''def f((a,), x): 3''')
check('''def f((a, b), x): 3''')
check('''def f((a, b,), x): 3''')
check('''def f((a, b, c), x): 3''')
check('''def f((a, b, c, d), x): 3''')
check('''def f((a), *args): 3''')
check('''def f((a,), *args): 3''')
check('''def f((a, b), *args): 3''')
check('''def f((a, b,), *args): 3''')
check('''def f((a, b, c), *args): 3''')
check('''def f((a, b, c, d), *args): 3''')
check('''def f(x, (a), *args): 3''')
check('''def f(x, (a,), *args): 3''')
check('''def f(x, (a, b), *args): 3''')
check('''def f(x, (a, b,), *args): 3''')
check('''def f(x, (a, b, c), *args): 3''')
check('''def f(x, (a, b, c, d), *args): 3''')
check('''def f((a), x, *args): 3''')
check('''def f((a,), x, *args): 3''')
check('''def f((a, b), x, *args): 3''')
check('''def f((a, b,), x, *args): 3''')
check('''def f((a, b, c), x, *args): 3''')
check('''def f((a, b, c, d), x, *args): 3''')
check('''def f((a), **kwds): 3''')
check('''def f((a,), **kwds): 3''')
check('''def f((a, b), **kwds): 3''')
check('''def f((a, b,), **kwds): 3''')
check('''def f((a, b, c), **kwds): 3''')
check('''def f((a, b, c, d), **kwds): 3''')
check('''def f(x, (a), **kwds): 3''')
check('''def f(x, (a,), **kwds): 3''')
check('''def f(x, (a, b), **kwds): 3''')
check('''def f(x, (a, b,), **kwds): 3''')
check('''def f(x, (a, b, c), **kwds): 3''')
check('''def f(x, (a, b, c, d), **kwds): 3''')
check('''def f((a), x, **kwds): 3''')
check('''def f((a,), x, **kwds): 3''')
check('''def f((a, b), x, **kwds): 3''')
check('''def f((a, b,), x, **kwds): 3''')
check('''def f((a, b, c), x, **kwds): 3''')
check('''def f((a, b, c, d), x, **kwds): 3''')
check('''def f((a), *args, **kwds): 3''')
check('''def f((a,), *args, **kwds): 3''')
check('''def f((a, b), *args, **kwds): 3''')
check('''def f((a, b,), *args, **kwds): 3''')
check('''def f((a, b, c), *args, **kwds): 3''')
check('''def f((a, b, c, d), *args, **kwds): 3''')
check('''def f(x, (a), *args, **kwds): 3''')
check('''def f(x, (a,), *args, **kwds): 3''')
check('''def f(x, (a, b), *args, **kwds): 3''')
check('''def f(x, (a, b,), *args, **kwds): 3''')
check('''def f(x, (a, b, c), *args, **kwds): 3''')
check('''def f(x, (a, b, c, d), *args, **kwds): 3''')
check('''def f((a), x, *args, **kwds): 3''')
check('''def f((a,), x, *args, **kwds): 3''')
check('''def f((a, b), x, *args, **kwds): 3''')
check('''def f((a, b,), x, *args, **kwds): 3''')
check('''def f((a, b, c), x, *args, **kwds): 3''')
check('''def f((a, b, c, d), x, *args, **kwds): 3''')
check('''def f(a, (b, (c, (d))), e=2, *args, **kwds): 3''')
check('''@a
def f(): 3''')
check('''@a.b
def f(): 3''')
check('''@a.b.c
def f(): 3''')
check('''@a.b.c.d
def f(): 3''')
check('''@a.b.c.d.e
def f(): 3''')
check('''@a.b.c.d.e
@a.b.c.d.e
def f(): 3''')
check('''@a()
def f(): 3''')
check('''@a(x)
def f(): 3''')
check('''@a(x,)
def f(): 3''')
check('''@a(x, y)
def f(): 3''')
check('''@a(x, y,)
def f(): 3''')
check('''@a(x, y, z)
def f(): 3''')
check('''@a(x, y, z,)
def f(): 3''')
check('''@a(x, y, z, w)
def f(): 3''')
check('''@a(x, y, z, w,)
def f(): 3''')
check('''@a(x, y, z, w, u)
def f(): 3''')
check('''@a(x, y, z, w, u,)
def f(): 3''')
check('''@a(x=1)
def f(): 3''')
check('''@a(x=1,)
def f(): 3''')
check('''@a(x, y=1)
def f(): 3''')
check('''@a(x, y=1,)
def f(): 3''')
check('''@a(x, y, z=1)
def f(): 3''')
check('''@a(x, y, z=1,)
def f(): 3''')
check('''@a(x, y, z, w=1)
def f(): 3''')
check('''@a(x, y, z, w=1,)
def f(): 3''')
check('''@a(x, y, z, w, u=1)
def f(): 3''')
check('''@a(x, y, z, w, u=1,)
def f(): 3''')
check('''@a(x=2, y=1)
def f(): 3''')
check('''@a(x=2, y=1,)
def f(): 3''')
check('''@a(x, y=2, z=1)
def f(): 3''')
check('''@a(x, y=2, z=1,)
def f(): 3''')
check('''@a(x, y, z=2, w=1)
def f(): 3''')
check('''@a(x, y, z=2, w=1,)
def f(): 3''')
check('''@a(x, y, z, w=2, u=1)
def f(): 3''')
check('''@a(x, y, z, w=2, u=1,)
def f(): 3''')
check('''@a(*args)
def f(): 3''')
check('''@a(x, *args)
def f(): 3''')
check('''@a(x, y, *args)
def f(): 3''')
check('''@a(x, y, z, *args)
def f(): 3''')
check('''@a(x, y, z, w, *args)
def f(): 3''')
check('''@a(x, y, z, w, u, *args)
def f(): 3''')
check('''@a(x=1, *args)
def f(): 3''')
check('''@a(x, y=1, *args)
def f(): 3''')
check('''@a(x, y, z=1, *args)
def f(): 3''')
check('''@a(x, y, z, w=1, *args)
def f(): 3''')
check('''@a(x, y, z, w, u=1, *args)
def f(): 3''')
check('''@a(x=2, y=1, *args)
def f(): 3''')
check('''@a(x, y=2, z=1, *args)
def f(): 3''')
check('''@a(x, y, z=2, w=1, *args)
def f(): 3''')
check('''@a(x, y, z, w=2, u=1, *args)
def f(): 3''')
check('''@a(**kwds)
def f(): 3''')
check('''@a(x, **kwds)
def f(): 3''')
check('''@a(x, y, **kwds)
def f(): 3''')
check('''@a(x, y, z, **kwds)
def f(): 3''')
check('''@a(x, y, z, w, **kwds)
def f(): 3''')
check('''@a(x, y, z, w, u, **kwds)
def f(): 3''')
check('''@a(x=1, **kwds)
def f(): 3''')
check('''@a(x, y=1, **kwds)
def f(): 3''')
check('''@a(x, y, z=1, **kwds)
def f(): 3''')
check('''@a(x, y, z, w=1, **kwds)
def f(): 3''')
check('''@a(x, y, z, w, u=1, **kwds)
def f(): 3''')
check('''@a(x=2, y=1, **kwds)
def f(): 3''')
check('''@a(x, y=2, z=1, **kwds)
def f(): 3''')
check('''@a(x, y, z=2, w=1, **kwds)
def f(): 3''')
check('''@a(x, y, z, w=2, u=1, **kwds)
def f(): 3''')
check('''@a(*args, **kwds)
def f(): 3''')
check('''@a(x, *args, **kwds)
def f(): 3''')
check('''@a(x, y, *args, **kwds)
def f(): 3''')
check('''@a(x, y, z, *args, **kwds)
def f(): 3''')
check('''@a(x, y, z, w, *args, **kwds)
def f(): 3''')
check('''@a(x, y, z, w, u, *args, **kwds)
def f(): 3''')
check('''@a(x=1, *args, **kwds)
def f(): 3''')
check('''@a(x, y=1, *args, **kwds)
def f(): 3''')
check('''@a(x, y, z=1, *args, **kwds)
def f(): 3''')
check('''@a(x, y, z, w=1, *args, **kwds)
def f(): 3''')
check('''@a(x, y, z, w, u=1, *args, **kwds)
def f(): 3''')
check('''@a(x=2, y=1, *args, **kwds)
def f(): 3''')
check('''@a(x, y=2, z=1, *args, **kwds)
def f(): 3''')
check('''@a(x, y, z=2, w=1, *args, **kwds)
def f(): 3''')
check('''@a(x, y, z, w=2, u=1, *args, **kwds)
def f(): 3''')
check('''@a(x=2, *args, y=1)
def f(): 3''')
check('''@a(x, *args, y=2, z=1)
def f(): 3''')
check('''@a(x, y, *args, z=2, w=1)
def f(): 3''')
check('''@a(x, y, z, *args, w=2, u=1)
def f(): 3''')
check('''@a(x=2, *args, y=1, **kwds)
def f(): 3''')
check('''@a(x, *args, y=2, z=1, **kwds)
def f(): 3''')
check('''@a(x, y, *args, z=2, w=1, **kwds)
def f(): 3''')
check('''@a(x, y, z, *args, w=2, u=1, **kwds)
def f(): 3''')
check('''@a(*args, y=1)
def f(): 3''')
check('''@a(*args, y=2, z=1)
def f(): 3''')
check('''@a(*args, z=2, w=1)
def f(): 3''')
check('''@a(*args, w=2, u=1)
def f(): 3''')
check('''@a(*args, y=1, **kwds)
def f(): 3''')
check('''@a(*args, y=2, z=1, **kwds)
def f(): 3''')
check('''@a(*args, z=2, w=1, **kwds)
def f(): 3''')
check('''@a(*args, w=2, u=1, **kwds)
def f(): 3''')
check('''f()''')
check('''f(x)''')
check('''f(x,)''')
check('''f(x, y)''')
check('''f(x, y,)''')
check('''f(x, y, z)''')
check('''f(x, y, z,)''')
check('''f(x, y, z, w)''')
check('''f(x, y, z, w,)''')
check('''f(x, y, z, w, u)''')
check('''f(x, y, z, w, u,)''')
check('''f(x=1)''')
check('''f(x=1,)''')
check('''f(x, y=1)''')
check('''f(x, y=1,)''')
check('''f(x, y, z=1)''')
check('''f(x, y, z=1,)''')
check('''f(x, y, z, w=1)''')
check('''f(x, y, z, w=1,)''')
check('''f(x, y, z, w, u=1)''')
check('''f(x, y, z, w, u=1,)''')
check('''f(x=2, y=1)''')
check('''f(x=2, y=1,)''')
check('''f(x, y=2, z=1)''')
check('''f(x, y=2, z=1,)''')
check('''f(x, y, z=2, w=1)''')
check('''f(x, y, z=2, w=1,)''')
check('''f(x, y, z, w=2, u=1)''')
check('''f(x, y, z, w=2, u=1,)''')
check('''f(*args)''')
check('''f(x, *args)''')
check('''f(x, y, *args)''')
check('''f(x, y, z, *args)''')
check('''f(x, y, z, w, *args)''')
check('''f(x, y, z, w, u, *args)''')
check('''f(x=1, *args)''')
check('''f(x, y=1, *args)''')
check('''f(x, y, z=1, *args)''')
check('''f(x, y, z, w=1, *args)''')
check('''f(x, y, z, w, u=1, *args)''')
check('''f(x=2, y=1, *args)''')
check('''f(x, y=2, z=1, *args)''')
check('''f(x, y, z=2, w=1, *args)''')
check('''f(x, y, z, w=2, u=1, *args)''')
check('''f(**kwds)''')
check('''f(x, **kwds)''')
check('''f(x, y, **kwds)''')
check('''f(x, y, z, **kwds)''')
check('''f(x, y, z, w, **kwds)''')
check('''f(x, y, z, w, u, **kwds)''')
check('''f(x=1, **kwds)''')
check('''f(x, y=1, **kwds)''')
check('''f(x, y, z=1, **kwds)''')
check('''f(x, y, z, w=1, **kwds)''')
check('''f(x, y, z, w, u=1, **kwds)''')
check('''f(x=2, y=1, **kwds)''')
check('''f(x, y=2, z=1, **kwds)''')
check('''f(x, y, z=2, w=1, **kwds)''')
check('''f(x, y, z, w=2, u=1, **kwds)''')
check('''f(*args, **kwds)''')
check('''f(x, *args, **kwds)''')
check('''f(x, y, *args, **kwds)''')
check('''f(x, y, z, *args, **kwds)''')
check('''f(x, y, z, w, *args, **kwds)''')
check('''f(x, y, z, w, u, *args, **kwds)''')
check('''f(x=1, *args, **kwds)''')
check('''f(x, y=1, *args, **kwds)''')
check('''f(x, y, z=1, *args, **kwds)''')
check('''f(x, y, z, w=1, *args, **kwds)''')
check('''f(x, y, z, w, u=1, *args, **kwds)''')
check('''f(x=2, y=1, *args, **kwds)''')
check('''f(x, y=2, z=1, *args, **kwds)''')
check('''f(x, y, z=2, w=1, *args, **kwds)''')
check('''f(x, y, z, w=2, u=1, *args, **kwds)''')
check('''f(x=2, *args, y=1)''')
check('''f(x, *args, y=2, z=1)''')
check('''f(x, y, *args, z=2, w=1)''')
check('''f(x, y, z, *args, w=2, u=1)''')
check('''f(x=2, *args, y=1, **kwds)''')
check('''f(x, *args, y=2, z=1, **kwds)''')
check('''f(x, y, *args, z=2, w=1, **kwds)''')
check('''f(x, y, z, *args, w=2, u=1, **kwds)''')
check('''f(*args, y=1)''')
check('''f(*args, y=2, z=1)''')
check('''f(*args, z=2, w=1)''')
check('''f(*args, w=2, u=1)''')
check('''f(*args, y=1, **kwds)''')
check('''f(*args, y=2, z=1, **kwds)''')
check('''f(*args, z=2, w=1, **kwds)''')
check('''f(*args, w=2, u=1, **kwds)''')
check('''f(a)(b)''')
check('''f(a)(b)(c)''')
check('''a''')
check('''a.b''')
check('''a.b.c''')
check('''a.b.c.d''')
check('''a.b.c.d.e''')
check('''a.b = 3''')
check('''a.b.c = 3''')
check('''a.b.c.d = 3''')
check('''a.b.c.d.e = 3''')
check('''del a''')
check('''del a.b''')
check('''del a.b.c''')
check('''del a.b.c.d''')
check('''del a.b.c.d.e''')
check('''a[1] = 3''')
check('''a[1][2] = 3''')
check('''a[1][2][3] = 3''')
check('''a[1][2][3][4] = 3''')
check('''del a[1]''')
check('''del a[1][2]''')
check('''del a[1][2][3]''')
check('''del a[1][2][3][4]''')
check('''(9).stuff''')
check('''((9)).stuff''')
check('''(((9))).stuff''')
check('''a[1]''')
check('''a["hey"]''')
check('''a[1:2]''')
check('''a[:]''')
check('''a[1:]''')
check('''a[:1]''')
check('''a[::]''')
check('''a[1::]''')
check('''a[:1:]''')
check('''a[::1]''')
check('''a[1:2:]''')
check('''a[:1:2]''')
check('''a[1::2]''')
check('''a[1:2:3]''')
check('''a[...]''')
check('''a[1,]''')
check('''a["hey",]''')
check('''a[1:2,]''')
check('''a[:,]''')
check('''a[1:,]''')
check('''a[:1,]''')
check('''a[::,]''')
check('''a[1::,]''')
check('''a[:1:,]''')
check('''a[::1,]''')
check('''a[1:2:,]''')
check('''a[:1:2,]''')
check('''a[1::2,]''')
check('''a[1:2:3,]''')
check('''a[...,]''')
check('''a[1,5]''')
check('''a["hey",5]''')
check('''a[1:2,5]''')
check('''a[:,5]''')
check('''a[1:,5]''')
check('''a[:1,5]''')
check('''a[::,5]''')
check('''a[1::,5]''')
check('''a[:1:,5]''')
check('''a[::1,5]''')
check('''a[1:2:,5]''')
check('''a[:1:2,5]''')
check('''a[1::2,5]''')
check('''a[1:2:3,5]''')
check('''a[...,5]''')
check('''a[1,5,]''')
check('''a["hey",5,]''')
check('''a[1:2,5,]''')
check('''a[:,5,]''')
check('''a[1:,5,]''')
check('''a[:1,5,]''')
check('''a[::,5,]''')
check('''a[1::,5,]''')
check('''a[:1:,5,]''')
check('''a[::1,5,]''')
check('''a[1:2:,5,]''')
check('''a[:1:2,5,]''')
check('''a[1::2,5,]''')
check('''a[1:2:3,5,]''')
check('''a[...,5,]''')
check('''a[1,"a":"b"]''')
check('''a["hey","a":"b"]''')
check('''a[1:2,"a":"b"]''')
check('''a[:,"a":"b"]''')
check('''a[1:,"a":"b"]''')
check('''a[:1,"a":"b"]''')
check('''a[::,"a":"b"]''')
check('''a[1::,"a":"b"]''')
check('''a[:1:,"a":"b"]''')
check('''a[::1,"a":"b"]''')
check('''a[1:2:,"a":"b"]''')
check('''a[:1:2,"a":"b"]''')
check('''a[1::2,"a":"b"]''')
check('''a[1:2:3,"a":"b"]''')
check('''a[...,"a":"b"]''')
check('''a[1,"a":"b",]''')
check('''a["hey","a":"b",]''')
check('''a[1:2,"a":"b",]''')
check('''a[:,"a":"b",]''')
check('''a[1:,"a":"b",]''')
check('''a[:1,"a":"b",]''')
check('''a[::,"a":"b",]''')
check('''a[1::,"a":"b",]''')
check('''a[:1:,"a":"b",]''')
check('''a[::1,"a":"b",]''')
check('''a[1:2:,"a":"b",]''')
check('''a[:1:2,"a":"b",]''')
check('''a[1::2,"a":"b",]''')
check('''a[1:2:3,"a":"b",]''')
check('''a[...,"a":"b",]''')
check('''a[1,...]''')
check('''a["hey",...]''')
check('''a[1:2,...]''')
check('''a[:,...]''')
check('''a[1:,...]''')
check('''a[:1,...]''')
check('''a[::,...]''')
check('''a[1::,...]''')
check('''a[:1:,...]''')
check('''a[::1,...]''')
check('''a[1:2:,...]''')
check('''a[:1:2,...]''')
check('''a[1::2,...]''')
check('''a[1:2:3,...]''')
check('''a[...,...]''')
check('''a[1,...,]''')
check('''a["hey",...,]''')
check('''a[1:2,...,]''')
check('''a[:,...,]''')
check('''a[1:,...,]''')
check('''a[:1,...,]''')
check('''a[::,...,]''')
check('''a[1::,...,]''')
check('''a[:1:,...,]''')
check('''a[::1,...,]''')
check('''a[1:2:,...,]''')
check('''a[:1:2,...,]''')
check('''a[1::2,...,]''')
check('''a[1:2:3,...,]''')
check('''a[...,...,]''')
check('''a[1,5,6]''')
check('''a["hey",5,6]''')
check('''a[1:2,5,6]''')
check('''a[:,5,6]''')
check('''a[1:,5,6]''')
check('''a[:1,5,6]''')
check('''a[::,5,6]''')
check('''a[1::,5,6]''')
check('''a[:1:,5,6]''')
check('''a[::1,5,6]''')
check('''a[1:2:,5,6]''')
check('''a[:1:2,5,6]''')
check('''a[1::2,5,6]''')
check('''a[1:2:3,5,6]''')
check('''a[...,5,6]''')
check('''a[1,5,6,]''')
check('''a["hey",5,6,]''')
check('''a[1:2,5,6,]''')
check('''a[:,5,6,]''')
check('''a[1:,5,6,]''')
check('''a[:1,5,6,]''')
check('''a[::,5,6,]''')
check('''a[1::,5,6,]''')
check('''a[:1:,5,6,]''')
check('''a[::1,5,6,]''')
check('''a[1:2:,5,6,]''')
check('''a[:1:2,5,6,]''')
check('''a[1::2,5,6,]''')
check('''a[1:2:3,5,6,]''')
check('''a[...,5,6,]''')
check('''a[1, "hey", 2:3, 4:5:6, ..., 7]''')
check('''a(1)[2].three''')
check('''a[2].three''')
check('''a.three''')
check('''a[2]''')
check('''a(1).three''')
check('''a(1)''')
check('''a(1)[2]''')
check('''a(1).three[2]''')
check('''a.three[2]''')
check('''a[2](1).three''')
check('''a[2](1)''')
check('''a[2].three(1)''')
check('''a.three(1)''')
check('''a.three(1)[2]''')
check('''a.three[2](1)''')
check('''import x''')
check('''import x as y''')
check('''import x, a''')
check('''import x as y, a''')
check('''import x, a as b''')
check('''import x as y, a as b''')
check('''import x as y, a as b, c''')
check('''import x as y, a as b, c, d''')
check('''from z import *''')
check('''from z import x''')
check('''from z import x as y''')
check('''from z import x, a''')
check('''from z import x as y, a''')
check('''from z import x, a as b''')
check('''from z import x as y, a as b''')
check('''from .z import *''')
check('''from .z import x''')
check('''from .z import x as y''')
check('''from .z import x, a''')
check('''from .z import x as y, a''')
check('''from .z import x, a as b''')
check('''from .z import x as y, a as b''')
check('''from ..z import *''')
check('''from ..z import x''')
check('''from ..z import x as y''')
check('''from ..z import x, a''')
check('''from ..z import x as y, a''')
check('''from ..z import x, a as b''')
check('''from ..z import x as y, a as b''')
check('''from ...z import *''')
check('''from ...z import x''')
check('''from ...z import x as y''')
check('''from ...z import x, a''')
check('''from ...z import x as y, a''')
check('''from ...z import x, a as b''')
check('''from ...z import x as y, a as b''')
check('''from z.q import *''')
check('''from z.q import x''')
check('''from z.q import x as y''')
check('''from z.q import x, a''')
check('''from z.q import x as y, a''')
check('''from z.q import x, a as b''')
check('''from z.q import x as y, a as b''')
check('''from .z.q import *''')
check('''from .z.q import x''')
check('''from .z.q import x as y''')
check('''from .z.q import x, a''')
check('''from .z.q import x as y, a''')
check('''from .z.q import x, a as b''')
check('''from .z.q import x as y, a as b''')
check('''from ..z.q import *''')
check('''from ..z.q import x''')
check('''from ..z.q import x as y''')
check('''from ..z.q import x, a''')
check('''from ..z.q import x as y, a''')
check('''from ..z.q import x, a as b''')
check('''from ..z.q import x as y, a as b''')
check('''from ...z.q import *''')
check('''from ...z.q import x''')
check('''from ...z.q import x as y''')
check('''from ...z.q import x, a''')
check('''from ...z.q import x as y, a''')
check('''from ...z.q import x, a as b''')
check('''from ...z.q import x as y, a as b''')
check('''from z import (x)''')
check('''from z import (x as y)''')
check('''from z import (x, a)''')
check('''from z import (x as y, a)''')
check('''from z import (x, a as b)''')
check('''from z import (x as y, a as b)''')
check('''from .z import (x)''')
check('''from .z import (x as y)''')
check('''from .z import (x as y,)''')
check('''from .z import (x, a)''')
check('''from .z import (x as y, a)''')
check('''from .z import (x as y, a,)''')
check('''from .z import (x as y, a, b)''')
check('''from .z import (x, a as b)''')
check('''from .z import (x as y, a as b)''')
check('''from ..z import (x)''')
check('''from ..z import (x as y)''')
check('''from ..z import (x, a)''')
check('''from ..z import (x as y, a)''')
check('''from ..z import (x, a as b)''')
check('''from ..z import (x as y, a as b)''')
check('''from ...z import (x)''')
check('''from ...z import (x as y)''')
check('''from ...z import (x, a)''')
check('''from ...z import (x as y, a)''')
check('''from ...z import (x, a as b)''')
check('''from ...z import (x as y, a as b)''')
check('''from z.q import (x)''')
check('''from z.q import (x as y)''')
check('''from z.q import (x, a)''')
check('''from z.q import (x as y, a)''')
check('''from z.q import (x, a as b)''')
check('''from z.q import (x as y, a as b)''')
check('''from .z.q import (x)''')
check('''from .z.q import (x as y)''')
check('''from .z.q import (x as y,)''')
check('''from .z.q import (x, a)''')
check('''from .z.q import (x as y, a)''')
check('''from .z.q import (x as y, a,)''')
check('''from .z.q import (x as y, a, b)''')
check('''from .z.q import (x, a as b)''')
check('''from .z.q import (x as y, a as b)''')
check('''from ..z.q import (x)''')
check('''from ..z.q import (x as y)''')
check('''from ..z.q import (x, a)''')
check('''from ..z.q import (x as y, a)''')
check('''from ..z.q import (x, a as b)''')
check('''from ..z.q import (x as y, a as b)''')
check('''from ...z.q import (x)''')
check('''from ...z.q import (x as y)''')
check('''from ...z.q import (x, a)''')
check('''from ...z.q import (x as y, a)''')
check('''from ...z.q import (x, a as b)''')
check('''from ...z.q import (x as y, a as b)''')
check('''from . import *''')
check('''from . import x''')
check('''from . import x as y''')
check('''from . import x, a''')
check('''from . import x as y, a''')
check('''from . import x, a as b''')
check('''from . import x as y, a as b''')
check('''from .. import *''')
check('''from .. import x''')
check('''from .. import x as y''')
check('''from .. import x, a''')
check('''from .. import x as y, a''')
check('''from .. import x, a as b''')
check('''from .. import x as y, a as b''')
check('''from ... import *''')
check('''from ... import x''')
check('''from ... import x as y''')
check('''from ... import x, a''')
check('''from ... import x as y, a''')
check('''from ... import x, a as b''')
check('''from ... import x as y, a as b''')
check('''from . import (x)''')
check('''from . import (x as y)''')
check('''from . import (x, a)''')
check('''from . import (x as y, a)''')
check('''from . import (x, a as b)''')
check('''from . import (x as y, a as b)''')
check('''from .. import (x)''')
check('''from .. import (x as y)''')
check('''from .. import (x, a)''')
check('''from .. import (x as y, a)''')
check('''from .. import (x, a as b)''')
check('''from .. import (x as y, a as b)''')
check('''from ... import (x)''')
check('''from ... import (x as y)''')
check('''from ... import (x, a)''')
check('''from ... import (x as y, a)''')
check('''from ... import (x, a as b)''')
check('''from ... import (x as y, a as b)''')
check('''del blah''')
check('''del blah, blahity''')
check('''del blah, (blahity, x, y)''')
check('''del blah, (blahity, (x), y)''')
check('''del blah, (blahity, ((x), y))''')
check('''pass''')
check('''while True: break''')
check('''while False: continue''')
check('''def f(): return''')
check('''def f(x): return x''')
check('''raise''')
check('''raise x''')
check('''raise x, y''')
check('''raise x, y, z''')
check('''def f(x): yield''')
check('''def f(x): yield x''')
check('''global x''')
check('''global x, y''')
check('''global x, y, z''')
check('''global x, y, z, w''')
check('''exec "3"''')
check('''exec "3" in globals()''')
check('''exec "3" in globals(), locals()''')
check('''assert x''')
check('''assert x, y''')
check('''x += 3''')
check('''x -= 3''')
check('''x *= 3''')
check('''x /= 3''')
check('''x %= 3''')
check('''x &= 3''')
check('''x |= 3''')
check('''x ^= 3''')
check('''x <<= 3''')
check('''x >>= 3''')
check('''x **= 3''')
check('''x //= 3''')
check('''class X: pass''')
check('''class X:
def something(): pass''')
check('''class X(object): pass''')
check('''class X(A, B): pass''')
check('''class X(A, B,): pass''')
check('''class X(): pass''')
check('''class X([A, B]): pass''')
check('''@some
class X: pass''')
check('''x += yield''')
check('''x = yield''')
check('''x = y = yield''')
check('''(yield)''')
check('''x += yield y''')
check('''x = yield y''')
check('''x = y = yield y''')
check('''(yield y)''')
check('''lambda: 3''')
check('''lambda x: 3''')
check('''lambda x, y=2: 3''')
check('''lambda x, y=2, *args: 3''')
check('''lambda x, y=2, *args, **kwds: 3''')
check('''[x for x in y]''')
check('''[x for x in y for a in b]''')
check('''[x for x in y for a in b for c in d]''')
check('''[x for x in y if x]''')
check('''[x for x in y if x for a in b]''')
check('''[x for x in y if x for a in b for c in d]''')
check('''[x for x in y for a in b if b]''')
check('''[x for x in y for a in b for c in d if d]''')
check('''[x for x in y if x if xx]''')
check('''[x for x in y if x if xx for a in b]''')
check('''[x for x in y if x if xx for a in b for c in d]''')
check('''[x for x in y if x if xx if x]''')
check('''[x for x in y if x if xx for a in b if a]''')
check('''[x for x in y if x if xx for a in b if b for c in d if c]''')
check('''(x for x in y)''')
check('''(x for x in y for a in b)''')
check('''(x for x in y for a in b for c in d)''')
check('''(x for x in y if x)''')
check('''(x for x in y if x for a in b)''')
check('''(x for x in y if x for a in b for c in d)''')
check('''(x for x in y for a in b if a)''')
check('''(x for x in y for a in b for c in d if c)''')
check('''(x for x in y if x if xx)''')
check('''(x for x in y if x if xx for a in b)''')
check('''(x for x in y if x if xx for a in b for c in d)''')
check('''(x for x in y if x if xx if x)''')
check('''(x for x in y if x if xx for a in b if a)''')
check('''(x for x in y if x if xx for a in b if a for c in d if c)''')
check('''{x for x in y}''')
check('''{x for x in y for a in b}''')
check('''{x for x in y for a in b for c in d}''')
check('''{x for x in y if x}''')
check('''{x for x in y if x for a in b}''')
check('''{x for x in y if x for a in b for c in d}''')
check('''{x for x in y for a in b if b}''')
check('''{x for x in y for a in b for c in d if d}''')
check('''{x for x in y if x if xx}''')
check('''{x for x in y if x if xx for a in b}''')
check('''{x for x in y if x if xx for a in b for c in d}''')
check('''{x for x in y if x if xx if x}''')
check('''{x for x in y if x if xx for a in b if a}''')
check('''{x for x in y if x if xx for a in b if b for c in d if c}''')
check('''{x: 3 for x in y}''')
check('''{x: 3 for x in y for a in b}''')
check('''{x: 3 for x in y for a in b for c in d}''')
check('''{x: 3 for x in y if x}''')
check('''{x: 3 for x in y if x for a in b}''')
check('''{x: 3 for x in y if x for a in b for c in d}''')
check('''{x: 3 for x in y for a in b if b}''')
check('''{x: 3 for x in y for a in b for c in d if d}''')
check('''{x: 3 for x in y if x if xx}''')
check('''{x: 3 for x in y if x if xx for a in b}''')
check('''{x: 3 for x in y if x if xx for a in b for c in d}''')
check('''{x: 3 for x in y if x if xx if x}''')
check('''{x: 3 for x in y if x if xx for a in b if a}''')
check('''{x: 3 for x in y if x if xx for a in b if b for c in d if c}''')
check('''f(x for x in y)''')
check('''f(x for x in y,)''')
check('''f((x for x in y), (x for x in y))''')
check('''f((x for x in y), (x for x in y),)''')
check('''None''')
check('''True''')
check('''False''')
check('''[x for x in lambda: True, lambda: False if x()]''')
check('''[x for x in lambda: True, lambda: False, if x()]''')
check('''[x for x in lambda: True, lambda: False, lambda: None if x()]''')
check('''[x for x in lambda x, y: True, lambda: False if x()]''')
check('''x if a else y''')
check('''x and y''')
check('''x and y and z''')
check('''x and y and z and w''')
check('''not x''')
check('''not x and y''')
check('''x or y''')
check('''x or y and z''')
check('''x or y or z''')
check('''not x or y and z''')
check('''x or not y and z''')
check('''x or y and not z''')
check('''not x or not y and z''')
check('''not x or y and not z''')
check('''x or not y and not z''')
check('''not x or not y and not z''')
check('''x and y or z''')
check('''not x and y or z''')
check('''x and not y or z''')
check('''x and y or not z''')
check('''not x and not y or z''')
check('''not x and y or not z''')
check('''x and not y or not z''')
check('''x < y''')
check('''x > y''')
check('''x == y''')
check('''x >= y''')
check('''x <= y''')
check('''x != y''')
check('''x in y''')
check('''x not in y''')
check('''x is y''')
check('''x is not y''')
check('''1 < y < 2''')
check('''1 < y == 2''')
check('''(x) < y''')
check('''(x) > y''')
check('''(x) == y''')
check('''(x) >= y''')
check('''(x) <= y''')
check('''(x) != y''')
check('''(x) in y''')
check('''(x) not in y''')
check('''(x) is y''')
check('''(x) is not y''')
check('''(1) < y < 2''')
check('''(1) < y == 2''')
check('''x < (y)''')
check('''x > (y)''')
check('''x == (y)''')
check('''x >= (y)''')
check('''x <= (y)''')
check('''x != (y)''')
check('''x in (y)''')
check('''x not in (y)''')
check('''x is (y)''')
check('''x is not (y)''')
check('''1 < (y) < 2''')
check('''1 < (y) == 2''')
check('''1 < y < (2)''')
check('''1 < y == (2)''')
check('''(x) < (y)''')
check('''(x) > (y)''')
check('''(x) == (y)''')
check('''(x) >= (y)''')
check('''(x) <= (y)''')
check('''(x) != (y)''')
check('''(x) in (y)''')
check('''(x) not in (y)''')
check('''(x) is (y)''')
check('''(x) is not (y)''')
check('''(1) < (y) < 2''')
check('''(1) < (y) == 2''')
check('''(1) < y < (2)''')
check('''(1) < y == (2)''')
check('''x | y''')
check('''x | y | z''')
check('''x | y | z | w''')
check('''x ^ y''')
check('''x ^ y ^ z''')
check('''x ^ y ^ z ^ w''')
check('''x ^ y | z ^ w''')
check('''x & y''')
check('''x & y & z''')
check('''x & y & z & w''')
check('''x & y << z & w''')
check('''x << y''')
check('''x << y << z''')
check('''x << y << z << w''')
check('''x << y & z << w''')
check('''x >> y''')
check('''x >> y >> z''')
check('''x >> y >> z >> w''')
check('''x >> y << z >> w''')
check('''x + y''')
check('''x + y + z''')
check('''x + y + z + w''')
check('''x + y >> z + w''')
check('''x - y''')
check('''x - y - z''')
check('''x - y - z - w''')
check('''x - y + z - w''')
check('''x * y''')
check('''x * y * z''')
check('''x * y * z * w''')
check('''x * y - z * w''')
check('''x / y''')
check('''x / y / z''')
check('''x / y / z / w''')
check('''x / y * z / w''')
check('''x % y''')
check('''x % y % z''')
check('''x % y % z % w''')
check('''x % y / z % w''')
check('''x // y''')
check('''x // y // z''')
check('''x // y // z // w''')
check('''x // y % z // w''')
check('''+x''')
check('''-x''')
check('''~x''')
check('''++x''')
check('''+-x''')
check('''+~x''')
check('''-+x''')
check('''--x''')
check('''-~x''')
check('''~+x''')
check('''~-x''')
check('''~~x''')
check('''+x + y''')
check('''-x + y''')
check('''~x + y''')
check('''++x + y''')
check('''+-x + y''')
check('''+~x + y''')
check('''-+x + y''')
check('''--x + y''')
check('''-~x + y''')
check('''~+x + y''')
check('''~-x + y''')
check('''~~x + y''')
check('''x + +x''')
check('''x + -x''')
check('''x + ~x''')
check('''x + ++x''')
check('''x + +-x''')
check('''x + +~x''')
check('''x + -+x''')
check('''x + --x''')
check('''x + -~x''')
check('''x + ~+x''')
check('''x + ~-x''')
check('''x + ~~x''')
check('''x ** y''')
check('''x ** y ** z''')
check('''x ** y ** z ** w''')
check('''x ** y // z ** w''')
check('''x() ** y''')
check('''x() ** y ** z''')
check('''x() ** y ** z ** w''')
check('''x() ** y // z ** w''')
check('''x ** y()''')
check('''x ** y() ** z''')
check('''x ** y() ** z ** w''')
check('''x ** y() // z ** w''')
check('''x ** y ** z()''')
check('''x ** y ** z() ** w''')
check('''x ** y // z() ** w''')
check('''x ** y ** z ** w()''')
check('''x ** y // z ** w()''')
check('''`x`''')
check('''`x, y`''')
check('''`x, y, z`''')
check('''print''')
check('''print "hello"''')
check('''print "hello",''')
check('''print "hello", 1''')
check('''print "hello", 1,''')
check('''print >> HEY''')
check('''print >> HEY, "hello"''')
check('''print >> HEY, "hello",''')
check('''print >> HEY, "hello", 1''')
check('''print >> HEY, "hello", 1,''')
check('print r"hello"')
check('print u"hello"')
check('print ur"hello"')
check('print R"hello"')
check('print U"hello"')
check('print UR"hello"')
check('print Ur"hello"')
check('print uR"hello"')
check('print b"hello"')
check('print B"hello"')
check('print br"hello"')
check('print Br"hello"')
check('print bR"hello"')
check('print BR"hello"')
check("print 'hello'")
check("print r'hello'")
check("print u'hello'")
check("print ur'hello'")
check("print R'hello'")
check("print U'hello'")
check("print UR'hello'")
check("print Ur'hello'")
check("print uR'hello'")
check("print b'hello'")
check("print B'hello'")
check("print br'hello'")
check("print Br'hello'")
check("print bR'hello'")
check("print BR'hello'")
check('print "hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo"')
check('print r"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo"')
check('print u"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\vlo\\N{LATIN SMALL LETTER ETH}\\u2212\\U00010905"')
check('print ur"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\vlo\\N{LATIN SMALL LETTER ETH}\\u2212\\U00010905"')
check('print R"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo"')
check('print U"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\vlo\\N{LATIN SMALL LETTER ETH}\\u2212\\U00010905"')
check('print UR"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\vlo\\N{LATIN SMALL LETTER ETH}\\u2212\\U00010905"')
check('print Ur"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\vlo\\N{LATIN SMALL LETTER ETH}\\u2212\\U00010905"')
check('print uR"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\vlo\\N{LATIN SMALL LETTER ETH}\\u2212\\U00010905"')
check('print b"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo"')
check('print B"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo"')
check('print br"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo"')
check('print Br"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo"')
check('print bR"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo"')
check('print BR"hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo"')
check('print \'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo\'')
check('print r\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo\'')
check('print u\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\vlo\\N{LATIN SMALL LETTER ETH}\\u2212\\U00010905lo\'')
check('print ur\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\vlo\\N{LATIN SMALL LETTER ETH}\\u2212\\U00010905lo\'')
check('print R\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo\'')
check('print U\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\vlo\\N{LATIN SMALL LETTER ETH}\\u2212\\U00010905lo\'')
check('print UR\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\vlo\\N{LATIN SMALL LETTER ETH}\\u2212\\U00010905lo\'')
check('print Ur\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\vlo\\N{LATIN SMALL LETTER ETH}\\u2212\\U00010905lo\'')
check('print uR\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\vlo\\N{LATIN SMALL LETTER ETH}\\u2212\\U00010905lo\'')
check('print b\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo\'')
check('print B\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo\'')
check('print br\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo\'')
check('print Br\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo\'')
check('print bR\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo\'')
check('print BR\'hel\\\n\\\\\\\'\\"\\a\\b\\f\\n\\r\\t\\v\\123\\o123\\xf3lo\'')
check('''
# This contains nearly every legal token and grammar in Python.
# Used for the python_yacc.py --self-test input.
# Might as well try the other imports here
import a
import a.b
import a.b.c
import a.b.c.d.e.f.g.h
import a as A
import a as A, b as B
import a.b as AB, a.b as B, a.b.c
''')
check('''
from mod1 import mod2
from mod1.mod2 import mod3
from qmod import *
from qmod.qmod2 import *
from a1 import a1
from a import (xrt,
yrt,
zrt,
zrt2)
from a import (xty,
yty,
zty,
zrt2,)
from qwe import *
from qwe.wer import *
from qwe.wer.ert.rty import *
''')
check('''
from .a import y
from ..a import y
from ..a import y as z
#from ...qwe import * This is not allowed
from ...a import (y as z, a as a2, t,)
from .................... import a,b,c # 20 levels
from ...................... import (a,b,c) # 22 levels
''')
check('''
a = 2
a,b = 1, 222
a, = 1,
a, b, = 1, 234
a, b, c
1;
1;27
1;28;
1;29;3
1;21;33;
a.b
a.b.c
a.b.c.d.e.f
''')
check('''
# Different number
0xDEADBEEF
0xDEADBEEFCAFE
0xDeadBeefCafe
0xDeadBeefCafeL
0xDeadBeefCafel
0o123
0o177
1.234
10E-3
1.2e+03
-1.9e+03
9j
9.8j
23.45E-9j
''')
check('''
# 'factor' operations
a = -1
a = +1
a = ~1
b ** c
a = + + + + 1
# 'comparison' 'comp_op' expressions
a < b
a > b
a == b
a >= b
a <= b
a != b
a in b
a is b
a not in b
a is not b
''')
check('''
# arith_expr
1 + 2
1 + 2 + 3
1 + 2 + 3 + 4
1 - 2
1 - 2 - 3
1 - 2 + 3 - 4 + 5
#
1 - 2 + - 3 - + 4
1 + + + + + 1
# factors
a * 1
a * 1 * 2
b / 2
b / 2 / 3
c % 9
c % 9 % 7
d // 8
d // 8 // 5
a * 1 / 2 / 3 * 9 % 7 // 2 // 1
''')
check('''
truth or dare
war and peace
this and that or that and this
a and b and c and d
x or y or z or w
not a
not not a
not not not a
not a or not b or not c
not a or not b and not c and not d
# All of the print statements
print
print "x"
print "a",
print 1, 2
print 1, 2,
print 1, 2, 93
print >>x
print >>x, 1
print >>x, 1,
print >>x, 9, 8
print >>x, 9, 8, 7
''')
check('''
def yield_function():
yield
yield 1
x = yield
@spam.qwe
def eggs():
pass
@spam
def eggs():
pass
@spam.qwe()
def eggs():
pass
@spam1.qwe()
@spam2.qwe()
@spam3.qwe()
@spam3.qwe()
def eggs():
pass
@spam(1)
def eggs():
pass
@spam2\
(\
)
def eggs2():
pass
''')
check('''
@spam3\
(\
this,\
blahblabh\
)
def eggs9():
pass
@spam\
(
**this
)
def qweqwe():
pass
@spam.\
and_.\
eggs\
(
**this
)
def qweqwe():
pass
spam()
spam(1)
spam(1,2)
spam(1,2,3)
spam(1,)
spam(1,2,)
spam(1,2,3,)
spam(*a)
spam(**a)
spam(*a,**b)
spam(1, *a)
spam(1, *a, **b)
spam(1, **b)
def spam(x): pass
def spam(x,): pass
def spam(a, b): pass
def spam(a, b,): pass
def spam(a, b, c): pass
def spam(a, *args): pass
def spam(a, *args, **kwargs): pass
def spam(a, **kwargs): pass
def spam(*args, **kwargs): pass
def spam(**kwargs): pass
def spam(*args): pass
def spam(x=1): pass
def spam(x=1,): pass
def spam(a=1, b=2): pass
def spam(a=1, b=2,): pass
def spam(a=1, *args): pass
def spam(a=9.1, *args, **kwargs): pass
def spam(a="", **kwargs): pass
def spam(a,b=1, *args): pass
def spam(a,b=9.1, *args, **kwargs): pass
def spam(a,b="", **kwargs): pass
def spam(a=1, b=2, *args): pass
def spam(a=1, b=2, *args, **kwargs): pass
def spam(a=1, b=2, **kwargs): pass
def spam(a=1, b=2, c=33, d=4): pass
#def spam((a) = c): pass # legal in Python 2.5, not 2.6
#def spam((((a))) = cc): pass # legal in Python 2.5, not 2.6
def spam((a,) = c): pass
def spam((a,b) = c): pass
def spam((a, (b, c)) = x96): pass
def spam((a,b,c)=x332): pass
def spam((a,b,c,d,e,f,g,h)=x12323): pass
''')
check('''
# This show that the compiler module uses the function name location
# for the ast.Function lineno, and not the "def" reserved word.
def \
spam \
( \
) \
: \
pass
a += 1
a -= 1
a *= 2
a /= 2
a %= 3
a &= 4
a |= 4
a ^= 5
a <<= 6
a >>= 7
a **= 9
a //= 10
b \
+= \
3
a = b = c
a = b = c = d
# Shows that the ast.Assign gets the lineno from the first '='
a \
= \
b \
= \
c
a < b < c < d < e
a == b == c != d != e
a | b | c | d
a & b & c & d
a | b | c & d & e
a ^ b
a ^ b ^ c ^ d
''')
check('''
a << 1
a << 1 << 2
a << c() << d[1]
a >> 3
a >> 6 >> 5
a >> 6 >> 5 >> 4 >> 3
a << 1 >> 2 << 3 >> 4
''')
check('''
del a
del a,
del a, b
del a, b,
del a, b, c
del a, b, c,
del a.b
del a.b,
del a.b.c.d.e.f
del a[0]
del a[0].b
del (a, b)
del a[:5]
del a[:5,1,2,...]
del [a,b,[c,d]]
''')
check('''
x = ()
x = (0)
x = (a,)
# x\
# \
# =\
# (\ <-- I put the Assign line number here
# a\
# ,\ <-- Python puts the Assign line number here
# )
''')
check('''
def spam():
a = (yield x)
s = "this " "is " "string " "concatenation"
s = "so " \
"is " \
"this."
#for x, in ((1,),):
# print x
for i in range(10):
continue
for a,b in x:
continue
for (a,b) in x:
break
''')
check('''
# p_trailer_3 : LSQB subscriptlist RSQB
x[0]
x[0,]
x[0:1]
x[0:1:2]
x[:3:4]
x[::6]
x[8::9]
a[...]
a[:]
b[:9]
c[:9,]
d[-4:]
a[0]**3
c[:9,:1]
q[7:,]
q[::4,]
q[:,]
t[::2]
r[1,2,3]
r[1,2,3,]
r[1,2,3,4]
r[1,2,3,4,]
t[::]
t[::,::]
t[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
p[1,2:,3:4]
p[1,2:,3:4,5:6:7,::,:9,::2, 1:2:3,
1,2:,3:4,5:6:7,::,:9,::2, 1:2:3]
x[1] = 1
x[1:2] = 2
x[1:] = 3
x[:1] = 4
x[:] = 5
a[1,2] = 11
a[1:2,3:4] = 12
[a] = [1]
[a] = 1,
[a,b,[c,d]] = 1,2,(3,4)
''')
check('''
# this is an 'atom'
{}
# an atom with a dictmaker
{1:2}
{1:2,}
{1:2,3:4}
{1:2,3:4,}
{1:2,3:4,5:6}
{1:2,3:4,5:6,}
{"name": "Andrew", "language": "Python", "dance": "tango"}
# Some lists
[]
[1]
[1,]
[1,2]
[1,2,]
[1,2,3,4,5,6]
[1,2,3,4,5,6,]
# List comprehensions
[1 for c in s]
[1 for c1 in s1 for c2 in s2]
[1 for c1 in s1 for c2 in s2 for c3 in s3]
[1 for c in s if c]
[(c,c2) for c in s1 if c != "n" for c2 in s2 if c2 != "a" if c2 != "e"]
[x.y for x.y in "this is legal"]
# Generator comprehensions
(1 for c in s)
(1 for c in s for d in t)
(x.y for x.y in "this is legal")
(1 for c in s if c if c+1 for d in t for e in u if d*e == c if 1 if 0)
# class definitions
class Spam:
pass
# This shows that Python gets the line number from the 'NAME'
class \
Spam:
pass
class Spam: pass
class Spam(object):
pass
class \
Spam \
(
object
) \
:
pass
class Spam(): pass
class \
Spam\
():
pass
''')
check('''
# backquotes
# Terminal "," are not supported
`1`
`1,2`
`1,2,3`
`a,b,c,d,e,f,g,h`
def a1():
return
def a2():
return 1,2
def a3():
return 1,2,3
try:
f()
except:
pass
try:
f()
finally:
pass
try:
f()
except Spam:
a=2
try:
f()
except (Spam, Eggs):
a=2
''')
# This is a Python 2.6-ism
check('''
try:
f()
except Spam as err:
p()
try:
f()
except Spam, err:
p()
try:
f()
except Spam:
g()
except Eggs:
h()
except (Vikings+Marmalade), err:
i()
try:
a()
except Spam: b()
except Spam2: c()
finally: g()
try:
a()
except:
b()
else:
c()
try: a()
except: b()
else: c()
finally: d()
try:
raise Fail1
except:
raise
try:
raise Fail2, "qwer"
except:
pass
try:
raise Fail3, "qwer", "trw23r"
except:
pass
try:
raise AssertionError("raise an instance")
except:
pass
''')
check('''
# with statements
with x1:
1+2
with x2 as a:
2+3
with x3 as a.b:
9
with x4 as a[1]:
10
with (x5,y6) as a.b[1]:
3+4
with x7 as (a,b):
4+5
#with x as (a+b): # should not work
# 5+6
with x8 as [a,b,[c.x.y,d[0]]]:
(9).__class__
''')
check('''
# make this 'x' and get the error "name 'x' is local and global"
# The compiler module doesn't verify this correctly. Python does
def spam(xyz):
global z
z = z + 1
global x, y
x,y=y,z
global a, b, c
a,b,c = b,c,a
exec "x=1"
exec "x=1" in x
exec "z=1" in z, y
exec "raise" in {}, globals()
assert 0
assert f(x)
assert f(x), "this is not right"
assert f(x), "this is not %s" % ["left", "right"][1]
''')
check('''
if 1:
g()
if 1: f()
if (a+1):
f()
g()
h()
pass
else:
pass
a()
b()
if a:
z()
elif b():
y()
elif c():
x
if a:
spam()
elif f()//g():
eggs()
else:
vikings()
while 1:
break
while a > 1:
a -= 1
else:
raise AssertionError("this is a problem")
for x in s:
1/0
for (a,b) in s:
2/0
for (a, b.c, d[1], e[1].d.f) in (p[1], t.r.e):
f(a)
for a in b:
break
else:
print "b was empty"
print "did you hear me?"
''')
check('''
# testlist_safe
[x for x in 1]
#[x for x in 1,] # This isn't legal
[x for x in 1,2]
[x for x in 1,2,]
[x for x in 1,2,3]
[x for x in 1,2,3,]
[x for x in 1,2,3,4]
[x for x in 1,2,3,4,]
#[x for x in lambda :2]
#[x for x in lambda x:2*x] # bug in compiler.transfomer prevents
#[x for x in lambda x,y:x*y] # testing "safe" lambdas with arguments
#[x for x in lambda x,y=2:x*y]
lambda x: 5 if x else 2
[ x for x in lambda: True, lambda: False if x() ]
#[ x for x in lambda: True, lambda: False if x else 2 ]
x = 1 if a else 2
y = 1 if a else 2 if b else 3
func = lambda : 1
func2 = lambda x, y: x+y
func3 = lambda x=2, y=3: x*y
f(1)
f(1,)
f(1,2)
f(1,2,)
f(1,2,3)
f(1,2,3,)
f(1,2,3,4)
f(1,2,3,4,)
f(a=1)
f(a=1,)
f(a=1, b=2)
f(a=1, b=2,)
f(a=1, b=2, c=3)
f(a=1, b=2, c=3,)
f(9, a=1)
f(9, a=1,)
f(9, a=1, b=2)
f(9, a=1, b=2,)
f(9, 8, a=1)
f(9, 7, a=1, b=2)
f(c for c in s)
f(x=2)
f(x, y=2)
f(x, *args, **kwargs)
#f(x+y=3)
## check some line number assignments. Python's compiler module uses
## the first term inside of the bracket/parens/braces. I prefer the
## line number of the first character (the '[', '(', or '{')
x = [
"a", "b",
# comment
"c", "d", "e", "f"
]
y = (
c for c in s)
def f():
welk = (
yield
)
d = {
"a":
1,
101: 102,
103: 104}
''')
check('''
# Check all the different ways of escaping and counting line numbers
"""
This text
goes over
various
lines.
"""
# this should have the right line number
x_triple_quoted = 3
\'\'\'
blah blah
and
blah
\'\'\'
''')
check('''
# this should have the right line number
y_triple_quoted = 34
r"""
when shall we three meet again
"""
# this should have the right line number
z_triple_quoted = 3235
r\'\'\'
This text
goes over
various
lines.
\'\'\'
# this should have the right line number
x_triple_quoted = 373
u"""
When in the
course of human
events
"""
''')
check('''
# this should have the right line number
x_triple_quoted = 65
ur\'\'\'
We hold these truths to be self-evident
\'\'\'
# this should have the right line number
y_triple_quoted = 3963
''')
check('''
# Check the escaping for the newline
s1 = r\'\'\'
This
has a newline\
and\
a\
few
more
\'\'\'
1
s1 = ur"""
Some more \
with\
newlines
"""
''')
check('''
str123 = 'single quoted line\
line with embedded\
newlines.'
str367 = "another \
with \
embedded\
newlines."
u"\N{LATIN SMALL LETTER ETH}"
ur"\N{LATIN SMALL LETTER ETH}"
f(1
+
2)
print "The end"
''')
for fileName in sorted(glob.glob("/usr/lib/python2.7/*.py")):
if "/_" not in fileName:
check(open(fileName).read(), fileName)
else:
print >> sys.stderr, "parse only:", fileName
grammar.parse(open(fileName).read())
| 24.636484
| 181
| 0.408648
| 12,633
| 74,279
| 2.396105
| 0.0357
| 0.066601
| 0.021407
| 0.021936
| 0.766402
| 0.729765
| 0.70152
| 0.667261
| 0.62481
| 0.597985
| 0
| 0.058847
| 0.261285
| 74,279
| 3,014
| 182
| 24.644658
| 0.49281
| 0.00342
| 0
| 0.242326
| 0
| 0.023835
| 0.540199
| 0.024994
| 0
| 0
| 0.000513
| 0
| 0.002889
| 0
| null | null | 0.023835
| 0.067533
| null | null | 0.035753
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6b283e3c97d335a03cc3ac35fb8362986d22e502
| 95
|
py
|
Python
|
twitter_analyzer/database_initialize.py
|
GrzegorzKrug/TwitterAnalyzer
|
875db2178deda640e35860370d63525262c71347
|
[
"Apache-2.0"
] | 1
|
2021-11-06T03:34:08.000Z
|
2021-11-06T03:34:08.000Z
|
twitter_analyzer/database_initialize.py
|
GrzegorzKrug/TwitterAnalyzer
|
875db2178deda640e35860370d63525262c71347
|
[
"Apache-2.0"
] | 22
|
2020-03-01T12:01:11.000Z
|
2020-07-03T13:50:00.000Z
|
twitter_analyzer/database_initialize.py
|
GrzegorzKrug/TwitterAnalyzer
|
875db2178deda640e35860370d63525262c71347
|
[
"Apache-2.0"
] | null | null | null |
from analyzer.database_operator import initialize
if __name__ == '__main__':
initialize()
| 19
| 49
| 0.768421
| 10
| 95
| 6.4
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.147368
| 95
| 4
| 50
| 23.75
| 0.790123
| 0
| 0
| 0
| 0
| 0
| 0.084211
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
860e9f30d640c9879eb6fe3ac419f83e3c1ee0e3
| 67
|
py
|
Python
|
app/schemas/misc.py
|
coherentmind/todo-list-backend
|
5b1a34b65e2e9dcab5ac64429511ed81ebb7dba2
|
[
"MIT"
] | 2
|
2021-05-19T07:21:59.000Z
|
2021-09-15T17:30:08.000Z
|
app/schemas/misc.py
|
coherentmind/todo-list-backend
|
5b1a34b65e2e9dcab5ac64429511ed81ebb7dba2
|
[
"MIT"
] | null | null | null |
app/schemas/misc.py
|
coherentmind/todo-list-backend
|
5b1a34b65e2e9dcab5ac64429511ed81ebb7dba2
|
[
"MIT"
] | null | null | null |
from pydantic import BaseModel
class Msg(BaseModel):
msg: str
| 13.4
| 30
| 0.746269
| 9
| 67
| 5.555556
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.19403
| 67
| 5
| 31
| 13.4
| 0.925926
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
861d256f2994202c7cb89e71fb1151571358f2d3
| 229
|
py
|
Python
|
ctapipe/calib/camera/__init__.py
|
chaimain/ctapipe
|
ff80cff2daaf56e1d05ea6501c68fd83a9cf79d5
|
[
"BSD-3-Clause"
] | 53
|
2015-06-23T15:24:20.000Z
|
2021-09-23T22:30:58.000Z
|
ctapipe/calib/camera/__init__.py
|
chaimain/ctapipe
|
ff80cff2daaf56e1d05ea6501c68fd83a9cf79d5
|
[
"BSD-3-Clause"
] | 1,537
|
2015-06-24T11:27:16.000Z
|
2022-03-31T16:17:08.000Z
|
ctapipe/calib/camera/__init__.py
|
chaimain/ctapipe
|
ff80cff2daaf56e1d05ea6501c68fd83a9cf79d5
|
[
"BSD-3-Clause"
] | 275
|
2015-07-09T14:09:28.000Z
|
2022-03-17T22:25:51.000Z
|
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Camera calibration module.
"""
from .calibrator import CameraCalibrator
from .gainselection import GainSelector
__all__ = ["CameraCalibrator", "GainSelector"]
| 22.9
| 63
| 0.777293
| 25
| 229
| 6.96
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005025
| 0.131004
| 229
| 9
| 64
| 25.444444
| 0.869347
| 0.388646
| 0
| 0
| 0
| 0
| 0.212121
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
865e50b5709b51939f9b5a2193b2b1bcf031e64c
| 195
|
py
|
Python
|
data_processor/paths.py
|
Keithcat1/synthizer
|
242a06855a36b9a9049d5fb00630800cda4a2984
|
[
"Unlicense"
] | 25
|
2020-09-05T18:21:21.000Z
|
2021-12-05T02:47:42.000Z
|
data_processor/paths.py
|
Keithcat1/synthizer
|
242a06855a36b9a9049d5fb00630800cda4a2984
|
[
"Unlicense"
] | 77
|
2020-07-08T23:33:46.000Z
|
2022-03-19T05:34:26.000Z
|
data_processor/paths.py
|
Keithcat1/synthizer
|
242a06855a36b9a9049d5fb00630800cda4a2984
|
[
"Unlicense"
] | 9
|
2020-07-08T18:16:53.000Z
|
2022-03-02T21:35:28.000Z
|
import os.path
processor_path = os.path.split(os.path.abspath(__file__))[0]
data_path = os.path.join(processor_path, "mit_kemar")
repo_path = os.path.abspath(os.path.join(processor_path, ".."))
| 32.5
| 63
| 0.753846
| 32
| 195
| 4.28125
| 0.40625
| 0.262774
| 0.218978
| 0.277372
| 0.335766
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005525
| 0.071795
| 195
| 5
| 64
| 39
| 0.751381
| 0
| 0
| 0
| 0
| 0
| 0.05641
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
866a3e43ac6a0a65cfc84133eaa9105e23f3da1a
| 125
|
py
|
Python
|
HealthChecker/web-app/test_fetchSymptoms.py
|
KriAga/Health-Checker
|
3d9ce933f131bcbb897103b0f509cc45393cae4a
|
[
"MIT"
] | 16
|
2019-05-06T10:19:45.000Z
|
2021-08-14T15:48:31.000Z
|
HealthChecker/web-app/test_fetchSymptoms.py
|
KriAga/Health-Checker
|
3d9ce933f131bcbb897103b0f509cc45393cae4a
|
[
"MIT"
] | null | null | null |
HealthChecker/web-app/test_fetchSymptoms.py
|
KriAga/Health-Checker
|
3d9ce933f131bcbb897103b0f509cc45393cae4a
|
[
"MIT"
] | 10
|
2020-01-07T01:51:21.000Z
|
2022-03-22T08:13:25.000Z
|
from unittest import TestCase
class TestFetchSymptoms(TestCase):
def test_fetch(self):
self.assertTrue(1 == 1)
| 17.857143
| 34
| 0.712
| 15
| 125
| 5.866667
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02
| 0.2
| 125
| 6
| 35
| 20.833333
| 0.86
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
86c1ddf4786814739f66522006eab077aca280f7
| 312
|
py
|
Python
|
app/schemas/template.py
|
svalenciaz/evergreen-messages-back-end
|
71e0a407b7af5e5377352f7315a1c459e3f3bba6
|
[
"MIT"
] | null | null | null |
app/schemas/template.py
|
svalenciaz/evergreen-messages-back-end
|
71e0a407b7af5e5377352f7315a1c459e3f3bba6
|
[
"MIT"
] | null | null | null |
app/schemas/template.py
|
svalenciaz/evergreen-messages-back-end
|
71e0a407b7af5e5377352f7315a1c459e3f3bba6
|
[
"MIT"
] | null | null | null |
def templateEntity(template) -> dict:
return{
"_id": str(template['_id']),
"name": template['name'],
"subject": template["subject"],
"content": template["content"],
}
def templateEntities(templates) -> list:
return [templateEntity(template) for template in templates]
| 31.2
| 63
| 0.621795
| 29
| 312
| 6.62069
| 0.517241
| 0.229167
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.217949
| 312
| 10
| 63
| 31.2
| 0.786885
| 0
| 0
| 0
| 0
| 0
| 0.134185
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0
| 0.222222
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
810564051b63778e583a112f8a912b16752d0326
| 997
|
py
|
Python
|
irekua_permissions/models/model_predictions.py
|
CONABIO-audio/irekua-permissions
|
563c558e59788054504c852a6a6017bce7469a12
|
[
"BSD-4-Clause"
] | null | null | null |
irekua_permissions/models/model_predictions.py
|
CONABIO-audio/irekua-permissions
|
563c558e59788054504c852a6a6017bce7469a12
|
[
"BSD-4-Clause"
] | 2
|
2020-02-12T03:00:51.000Z
|
2020-04-26T23:27:52.000Z
|
irekua_permissions/models/model_predictions.py
|
CONABIO-audio/irekua-permissions
|
563c558e59788054504c852a6a6017bce7469a12
|
[
"BSD-4-Clause"
] | null | null | null |
from irekua_permissions.items import items
def list(user, **kwargs):
if user.is_superuser:
return True
if user.is_developer:
return True
return user.is_model
def view(user, model_prediction=None, **kwargs):
if model_prediction is None:
return True
if user.is_superuser:
return True
if user.is_developer:
return True
if user.is_model:
return True
item = model_prediction.item
return items.view(user, item=item)
def create(user, **kwargs):
if user.is_superuser:
return True
if user.is_developer:
return True
return user.is_model
def delete(user, model_prediction=None, **kwargs):
if user.is_superuser:
return True
if user.is_developer:
return True
return user.is_model
def update(user, model_prediction=None, **kwargs):
if user.is_superuser:
return True
if user.is_developer:
return True
return user.is_model
| 16.898305
| 50
| 0.651956
| 134
| 997
| 4.69403
| 0.171642
| 0.143084
| 0.139905
| 0.17806
| 0.753577
| 0.72496
| 0.675676
| 0.675676
| 0.675676
| 0.675676
| 0
| 0
| 0.27683
| 997
| 58
| 51
| 17.189655
| 0.872399
| 0
| 0
| 0.722222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.138889
| false
| 0
| 0.027778
| 0
| 0.638889
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
810cd01a9b19d771994b4e542d36bfa564101a13
| 70
|
py
|
Python
|
src/cnn/__init__.py
|
portelaraian/tuberculosis-runmila-minoHealth
|
03f7f146e913053399ec31bc0aeda018df9b2eff
|
[
"MIT"
] | null | null | null |
src/cnn/__init__.py
|
portelaraian/tuberculosis-runmila-minoHealth
|
03f7f146e913053399ec31bc0aeda018df9b2eff
|
[
"MIT"
] | null | null | null |
src/cnn/__init__.py
|
portelaraian/tuberculosis-runmila-minoHealth
|
03f7f146e913053399ec31bc0aeda018df9b2eff
|
[
"MIT"
] | null | null | null |
import cv2
cv2.setNumThreads(0) # fix potential pytorch worker issues
| 23.333333
| 58
| 0.814286
| 10
| 70
| 5.7
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.04918
| 0.128571
| 70
| 2
| 59
| 35
| 0.885246
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
811657484c07d1f660597ac8755d2606f4a5cd9f
| 139
|
py
|
Python
|
direct/src/controls/__init__.py
|
cmarshall108/panda3d-python3
|
8bea2c0c120b03ec1c9fd179701fdeb7510bb97b
|
[
"PHP-3.0",
"PHP-3.01"
] | null | null | null |
direct/src/controls/__init__.py
|
cmarshall108/panda3d-python3
|
8bea2c0c120b03ec1c9fd179701fdeb7510bb97b
|
[
"PHP-3.0",
"PHP-3.01"
] | 20
|
2021-05-03T18:02:23.000Z
|
2022-03-12T12:01:04.000Z
|
Lib/site-packages/direct/controls/__init__.py
|
fochoao/cpython
|
3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9
|
[
"bzip2-1.0.6",
"0BSD"
] | 1
|
2021-04-09T00:02:59.000Z
|
2021-04-09T00:02:59.000Z
|
"""
This package contains various types of character controllers, handling basic
control mechanics and setting up collisions for them.
"""
| 27.8
| 76
| 0.798561
| 18
| 139
| 6.166667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.143885
| 139
| 4
| 77
| 34.75
| 0.932773
| 0.935252
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d4ba15cdee3561f157ed4a9b5c4f02b702371dcf
| 303
|
py
|
Python
|
ml_expr_eval_app/dataset.py
|
mondrasovic/ml_math_expr_eval
|
58acbe6f80589cd8cad8323d7195a0f2df5111b8
|
[
"MIT"
] | null | null | null |
ml_expr_eval_app/dataset.py
|
mondrasovic/ml_math_expr_eval
|
58acbe6f80589cd8cad8323d7195a0f2df5111b8
|
[
"MIT"
] | null | null | null |
ml_expr_eval_app/dataset.py
|
mondrasovic/ml_math_expr_eval
|
58acbe6f80589cd8cad8323d7195a0f2df5111b8
|
[
"MIT"
] | null | null | null |
from torch.utils.data import IterableDataset, DataLoader
from exprgen import generate_expressions
class MathExprDataset(IterableDataset):
def __iter__(self):
pass
@staticmethod
def _char_to_idx(c):
if ord('0') <= c <= ord('9'):
return c - ord('c')
| 23.307692
| 56
| 0.627063
| 35
| 303
| 5.2
| 0.742857
| 0.043956
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.00905
| 0.270627
| 303
| 13
| 57
| 23.307692
| 0.81448
| 0
| 0
| 0
| 1
| 0
| 0.009868
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0.111111
| 0.222222
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
d4cb9555efb4a5d6bfba0e147763c393fd407b6e
| 1,646
|
py
|
Python
|
src/services/vinkki_service.py
|
a-bzzzz/ohtu-lukuvinkkikirjasto
|
4f6c780fa3fda5198fc9d61f9449f3f3b01b955e
|
[
"MIT"
] | null | null | null |
src/services/vinkki_service.py
|
a-bzzzz/ohtu-lukuvinkkikirjasto
|
4f6c780fa3fda5198fc9d61f9449f3f3b01b955e
|
[
"MIT"
] | null | null | null |
src/services/vinkki_service.py
|
a-bzzzz/ohtu-lukuvinkkikirjasto
|
4f6c780fa3fda5198fc9d61f9449f3f3b01b955e
|
[
"MIT"
] | null | null | null |
from entities.lukuvinkki import Lukuvinkki
from entities.lukuvinkkilista import Lukuvinkkilista
from entities.user import User
from repositories.lukuvinkki_repository import (
lukuvinkki_repository as default_lukuvinkki_repository
)
class VinkkiService:
def __init__(self, lukuvinkki_repository=default_lukuvinkki_repository):
self.users = []
#self.vinkkilista = Lukuvinkkilista()
self._lukuvinkki_repository = lukuvinkki_repository
def create_user(self, id, username, password): # pylint: disable invalid-name
return User(id, username, password) # pylint: disable invalid-name
def create_vinkki(self, tyyppi, otsikko, kirjailija, isbn=None, tagit=None, url=None,
kommentti=None, kuvaus=None, kurssit=None, luettu=False):
return Lukuvinkki(tyyppi, otsikko, kirjailija, isbn, tagit, url, kommentti,
kuvaus, kurssit, luettu)
def add_vinkki_to_vinkkilista(self, vinkki):
#self.vinkkilista.lisaa(vinkki)
self._lukuvinkki_repository.create(vinkki)
# def listaa_vinkit(self):
# self.vinkkilista.listaa()
def listaa_lukuvinkit(self):
return self._lukuvinkki_repository.hae_vinkit()
def muokkaa_vinkkia(self, otsikko, kirjailija, isbn, tagit, url, kommentti, kuvaus, kurssit):
self._lukuvinkki_repository.muokkaa_vinkkia(otsikko, kirjailija, isbn, tagit, url, kommentti, kuvaus, kurssit)
def palauta_lista(self):
#return self.vinkkilista.palauta_lista()
#return self._lukuvinkki_repository.hae_vinkit()
return self.listaa_lukuvinkit()
vinkki_service = VinkkiService()
| 38.27907
| 118
| 0.730863
| 179
| 1,646
| 6.513966
| 0.284916
| 0.188679
| 0.123499
| 0.066895
| 0.270154
| 0.270154
| 0.203259
| 0.131218
| 0
| 0
| 0
| 0
| 0.184083
| 1,646
| 42
| 119
| 39.190476
| 0.868206
| 0.164642
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.28
| false
| 0.08
| 0.16
| 0.16
| 0.64
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
d4d755e85dcfc9a9e8c6bb026473ea8fecd9d429
| 177
|
py
|
Python
|
apps/album/admin.py
|
maruuuui/album-server
|
2cce203ae174200bb0981cf97661d6584fd88840
|
[
"MIT"
] | null | null | null |
apps/album/admin.py
|
maruuuui/album-server
|
2cce203ae174200bb0981cf97661d6584fd88840
|
[
"MIT"
] | 7
|
2021-03-19T00:40:07.000Z
|
2022-01-13T02:24:24.000Z
|
apps/album/admin.py
|
maruuuui/album-server
|
2cce203ae174200bb0981cf97661d6584fd88840
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Image
@admin.register(Image)
class ImageAdmin(admin.ModelAdmin):
list_display = ("image", "created_at", "updated_at")
| 22.125
| 56
| 0.757062
| 23
| 177
| 5.695652
| 0.695652
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.124294
| 177
| 7
| 57
| 25.285714
| 0.845161
| 0
| 0
| 0
| 0
| 0
| 0.141243
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
d4df300969dde994d37376e3b484908ca5ac0738
| 92
|
py
|
Python
|
Osori_rpg/apps.py
|
bees1114/Osori_level_meter
|
6af9b06e91fc4935be75e8293879e2bf881beefe
|
[
"MIT"
] | 1
|
2017-11-04T21:27:59.000Z
|
2017-11-04T21:27:59.000Z
|
Osori_rpg/apps.py
|
bees1114/Osori_level_meter
|
6af9b06e91fc4935be75e8293879e2bf881beefe
|
[
"MIT"
] | null | null | null |
Osori_rpg/apps.py
|
bees1114/Osori_level_meter
|
6af9b06e91fc4935be75e8293879e2bf881beefe
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class OsoriRpgConfig(AppConfig):
name = 'Osori_rpg'
| 15.333333
| 33
| 0.76087
| 11
| 92
| 6.272727
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.163043
| 92
| 5
| 34
| 18.4
| 0.896104
| 0
| 0
| 0
| 0
| 0
| 0.097826
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
d4e5eb6d40be1167556560c4dec15e1013988ee0
| 197
|
py
|
Python
|
tests/__init__.py
|
PASTAplus/rendere
|
63cc5effae4118fa20545339c2f0b0ebbee35271
|
[
"Apache-2.0"
] | null | null | null |
tests/__init__.py
|
PASTAplus/rendere
|
63cc5effae4118fa20545339c2f0b0ebbee35271
|
[
"Apache-2.0"
] | 5
|
2021-04-01T02:12:50.000Z
|
2022-03-14T01:40:58.000Z
|
tests/__init__.py
|
PASTAplus/rendere
|
63cc5effae4118fa20545339c2f0b0ebbee35271
|
[
"Apache-2.0"
] | 1
|
2020-09-22T21:47:31.000Z
|
2020-09-22T21:47:31.000Z
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:Mod: __init__
:Synopsis:
:Author:
servilla
:Created:
1/21/20
"""
import os
import sys
sys.path.insert(0, os.path.abspath('../src'))
| 9.85
| 45
| 0.593909
| 28
| 197
| 4.035714
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.043478
| 0.182741
| 197
| 19
| 46
| 10.368421
| 0.658385
| 0.583756
| 0
| 0
| 0
| 0
| 0.082192
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
be1b86960f931041a13f12317837457dc61cf7c7
| 432
|
py
|
Python
|
homework_02/teste.py
|
ufpa-organization-repositories/evolutionary-computing
|
e16786f9619e2b357b94ab91ff3a7b352e6a0d92
|
[
"MIT"
] | null | null | null |
homework_02/teste.py
|
ufpa-organization-repositories/evolutionary-computing
|
e16786f9619e2b357b94ab91ff3a7b352e6a0d92
|
[
"MIT"
] | null | null | null |
homework_02/teste.py
|
ufpa-organization-repositories/evolutionary-computing
|
e16786f9619e2b357b94ab91ff3a7b352e6a0d92
|
[
"MIT"
] | null | null | null |
# pop_pais = [1,3,5,4]
# pop_pais = sorted(pop_pais, reverse=True)
# print(pop_pais)
#
# pop_pais = pop_pais[:2]
# print(pop_pais)
# teste mutacao
# individuo_aux = 'abcd'
# individuo_aux = list(individuo_aux)
# print(individuo_aux)
# i_gene = 0
# individuo_aux[i_gene] = 'teste'
# print(individuo_aux)
# individuo_aux = ''.join(individuo_aux)
# print(individuo_aux)
# tamanho de um individuo
print(len('1.11011010000000000000'))
| 21.6
| 43
| 0.719907
| 64
| 432
| 4.578125
| 0.40625
| 0.368601
| 0.174061
| 0.095563
| 0.197952
| 0
| 0
| 0
| 0
| 0
| 0
| 0.071618
| 0.127315
| 432
| 20
| 44
| 21.6
| 0.70557
| 0.833333
| 0
| 0
| 0
| 0
| 0.392857
| 0.392857
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
077082f46dfee06914373c054762f65f957efab1
| 633
|
py
|
Python
|
src/super_gradients/common/__init__.py
|
Deci-AI/super-gradients
|
658f638389654668a085e23c3b19622241fd9267
|
[
"Apache-2.0"
] | 308
|
2021-12-30T10:14:30.000Z
|
2022-03-30T19:05:31.000Z
|
src/super_gradients/common/__init__.py
|
karndeepsingh/super-gradients
|
bfed440ecaf485af183570bf965eb5b74cb9f832
|
[
"Apache-2.0"
] | 24
|
2022-01-10T08:05:37.000Z
|
2022-03-30T18:49:06.000Z
|
src/super_gradients/common/__init__.py
|
karndeepsingh/super-gradients
|
bfed440ecaf485af183570bf965eb5b74cb9f832
|
[
"Apache-2.0"
] | 26
|
2021-12-31T06:04:07.000Z
|
2022-03-21T09:51:44.000Z
|
# PACKAGE IMPORTS FOR EXTERNAL USAGE
from super_gradients.common.decorators import explicit_params_validation, singleton
from super_gradients.common.aws_connection import AWSConnector
from super_gradients.common.data_connection import S3Connector
from super_gradients.common.data_interface import DatasetDataInterface, ADNNModelRepositoryDataInterfaces
from super_gradients.common.environment.env_helpers import init_trainer, is_distributed
__all__ = ['explicit_params_validation', 'singleton', 'AWSConnector', 'DatasetDataInterface',
'ADNNModelRepositoryDataInterfaces', 'S3Connector', 'init_trainer', 'is_distributed']
| 63.3
| 105
| 0.85466
| 65
| 633
| 8
| 0.476923
| 0.086538
| 0.173077
| 0.230769
| 0.107692
| 0
| 0
| 0
| 0
| 0
| 0
| 0.003436
| 0.080569
| 633
| 9
| 106
| 70.333333
| 0.890034
| 0.053712
| 0
| 0
| 0
| 0
| 0.229481
| 0.098827
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.714286
| 0
| 0.714286
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
0779782f204986f729b1b61be253c1eb07ad235f
| 2,196
|
py
|
Python
|
src/scs_core/osio/data/topic_contributor.py
|
seoss/scs_core
|
0d4323c5697a39eb44a887f179ba5dca3716c1d2
|
[
"MIT"
] | 3
|
2019-03-12T01:59:58.000Z
|
2020-09-12T07:27:42.000Z
|
src/scs_core/osio/data/topic_contributor.py
|
seoss/scs_core
|
0d4323c5697a39eb44a887f179ba5dca3716c1d2
|
[
"MIT"
] | 1
|
2018-04-20T07:58:38.000Z
|
2021-03-27T08:52:45.000Z
|
src/scs_core/osio/data/topic_contributor.py
|
seoss/scs_core
|
0d4323c5697a39eb44a887f179ba5dca3716c1d2
|
[
"MIT"
] | 4
|
2017-09-29T13:08:43.000Z
|
2019-10-09T09:13:58.000Z
|
"""
Created on 10 Nov 2016
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
example:
{
"name": "South Coast Science - Dev",
"id": "southcoastscience-dev",
"gravatar-hash": "07f512e9fe64863039df0c0f1834cc25"
}
"""
from collections import OrderedDict
from scs_core.data.json import JSONable
# --------------------------------------------------------------------------------------------------------------------
class TopicContributor(JSONable):
"""
classdocs
"""
# ----------------------------------------------------------------------------------------------------------------
@classmethod
def construct_from_jdict(cls, jdict):
if not jdict:
return None
name = jdict.get('name')
id = jdict.get('id')
gravatar_hash = jdict.get('gravatar-hash')
return TopicContributor(name, id, gravatar_hash)
# ----------------------------------------------------------------------------------------------------------------
def __init__(self, name, id, gravatar_hash):
"""
Constructor
"""
self.__name = name # string
self.__id = id # string
self.__gravatar_hash = gravatar_hash # string
# ----------------------------------------------------------------------------------------------------------------
def as_json(self):
jdict = OrderedDict()
jdict['name'] = self.name
jdict['id'] = self.id
jdict['gravatar-hash'] = self.gravatar_hash
return jdict
# ----------------------------------------------------------------------------------------------------------------
@property
def name(self):
return self.__name
@property
def id(self):
return self.__id
@property
def gravatar_hash(self):
return self.__gravatar_hash
# ----------------------------------------------------------------------------------------------------------------
def __str__(self, *args, **kwargs):
return "TopicContributor:{name:%s, id:%s, gravatar_hash:%s}" % (self.name, self.id, self.gravatar_hash)
| 26.142857
| 118
| 0.397541
| 159
| 2,196
| 5.27673
| 0.327044
| 0.185936
| 0.076281
| 0.042908
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.01627
| 0.216302
| 2,196
| 83
| 119
| 26.457831
| 0.471238
| 0.434426
| 0
| 0.09375
| 0
| 0
| 0.074916
| 0.021886
| 0
| 0
| 0
| 0
| 0
| 1
| 0.21875
| false
| 0
| 0.0625
| 0.125
| 0.53125
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
0783e19a212511cc775bbd03c8c563c5c0967358
| 592
|
py
|
Python
|
eccrypt/__init__.py
|
i5ar/eccrypt
|
0e6e7fa6354cb8f3b1a115ee5ce11df112a08ada
|
[
"MIT"
] | null | null | null |
eccrypt/__init__.py
|
i5ar/eccrypt
|
0e6e7fa6354cb8f3b1a115ee5ce11df112a08ada
|
[
"MIT"
] | null | null | null |
eccrypt/__init__.py
|
i5ar/eccrypt
|
0e6e7fa6354cb8f3b1a115ee5ce11df112a08ada
|
[
"MIT"
] | null | null | null |
# 10
# 100~~01 100~~\ 100~~\ 000~0\ 0000 / 000~0001 _100__
# d000 001 d000 1000 000 0000/ 000 0000 000
# 0000__000 0000 0000 000 00/ 000 0000 000
# 1000 , 1000 1000 000 0 000 0000 000
# "00___/ "00__/ 100__/ 000 / 000~0001 100_/
# _/ 000
"""Easy Crypt.
Easy encryption and decryption.
"""
__title__ = 'eccrypt'
__version__ = "0.0.6"
__author__ = "Pierpaolo Rasicci"
__copyright__ = "Copyright (c) 2017 iSar"
__license__ = "MIT"
| 31.157895
| 59
| 0.494932
| 67
| 592
| 3.865672
| 0.432836
| 0.189189
| 0.19305
| 0.162162
| 0.108108
| 0.108108
| 0
| 0
| 0
| 0
| 0
| 0.418803
| 0.407095
| 592
| 18
| 60
| 32.888889
| 0.319088
| 0.726351
| 0
| 0
| 0
| 0
| 0.369128
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
07875ad8ddedafe6bb9942245b8324c5e68343e2
| 70
|
py
|
Python
|
tests/conftests.py
|
LSmith-Zenoscave/dotdict
|
48994d23321df3e3b9feb8ecde852fbb0443f231
|
[
"BSD-2-Clause"
] | 1
|
2021-06-15T06:11:56.000Z
|
2021-06-15T06:11:56.000Z
|
tests/conftests.py
|
LSmith-Zenoscave/dotdict
|
48994d23321df3e3b9feb8ecde852fbb0443f231
|
[
"BSD-2-Clause"
] | 2
|
2019-07-11T01:04:28.000Z
|
2019-07-11T01:48:34.000Z
|
tests/conftests.py
|
LSmith-Zenoscave/dotdict
|
48994d23321df3e3b9feb8ecde852fbb0443f231
|
[
"BSD-2-Clause"
] | null | null | null |
# -*- coding: utf-8 -*-
"""Pytest Fixtures for dotdict unit-tests
"""
| 17.5
| 41
| 0.614286
| 9
| 70
| 4.777778
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.016949
| 0.157143
| 70
| 3
| 42
| 23.333333
| 0.711864
| 0.871429
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
0788713465f353b2dc95e2a1f09b7be0ffabd337
| 3,399
|
py
|
Python
|
tables_validation.py
|
joch182/3G-Huawei-Propagation-Delay-Tool-Google-Earth
|
c14569dad2f1daad8072661b55554d182497f1d5
|
[
"MIT"
] | null | null | null |
tables_validation.py
|
joch182/3G-Huawei-Propagation-Delay-Tool-Google-Earth
|
c14569dad2f1daad8072661b55554d182497f1d5
|
[
"MIT"
] | null | null | null |
tables_validation.py
|
joch182/3G-Huawei-Propagation-Delay-Tool-Google-Earth
|
c14569dad2f1daad8072661b55554d182497f1d5
|
[
"MIT"
] | 1
|
2020-07-24T14:08:08.000Z
|
2020-07-24T14:08:08.000Z
|
import sys
import pandas as pd
def validate(data_path, ept_path):
if not (data_path.endswith('.csv') or ept_path.endswith('.csv')):
print('Please use the correct table format (CSV)')
sys.exit()
data = pd.read_csv(data_path, index_col="Cell_Name")
ept = pd.read_csv(ept_path, index_col="Cell_Name")
print(data.index.name)
if (len(data.columns) != 36 or data.index.name != 'Cell_Name' or data.columns.values[0] != 'VS.TP.UE.0' or data.columns.values[1] != 'VS.TP.UE.1' or data.columns.values[2] != 'VS.TP.UE.2' or data.columns.values[3] != 'VS.TP.UE.3' or data.columns.values[4] != 'VS.TP.UE.4' or data.columns.values[5] != 'VS.TP.UE.5' or data.columns.values[6] != 'VS.TP.UE.6.9' or data.columns.values[7] != 'VS.TP.UE.10.15' or data.columns.values[8] != 'VS.TP.UE.16.25' or data.columns.values[9] != 'VS.TP.UE.26.35' or data.columns.values[10] != 'VS.TP.UE.36.55' or data.columns.values[11] != 'VS.TP.UE.More55' or data.columns.values[12] != 'VS.EcNo.Mean.TP0(dB)' or data.columns.values[13] != 'VS.EcNo.Mean.TP1(dB)' or data.columns.values[14] != 'VS.EcNo.Mean.TP2(dB)' or data.columns.values[15] != 'VS.EcNo.Mean.TP3(dB)' or data.columns.values[16] != 'VS.EcNo.Mean.TP4(dB)' or data.columns.values[17] != 'VS.EcNo.Mean.TP5(dB)' or data.columns.values[18] != 'VS.EcNo.Mean.TP6.9(dB)' or data.columns.values[19] != 'VS.EcNo.Mean.TP10.15(dB)' or data.columns.values[20] != 'VS.EcNo.Mean.TP16.25(dB)' or data.columns.values[21] != 'VS.EcNo.Mean.TP26.35(dB)' or data.columns.values[22] != 'VS.EcNo.Mean.TP36.55(dB)'or data.columns.values[23] != 'VS.EcNo.Mean.TP.More55(dB)'or data.columns.values[24] != 'VS.RSCP.Mean.TP0(dBm)'or data.columns.values[25] != 'VS.RSCP.Mean.TP1(dBm)'or data.columns.values[26] != 'VS.RSCP.Mean.TP2(dBm)'or data.columns.values[27] != 'VS.RSCP.Mean.TP3(dBm)'or data.columns.values[28] != 'VS.RSCP.Mean.TP4(dBm)'or data.columns.values[29] != 'VS.RSCP.Mean.TP5(dBm)'or data.columns.values[30] != 'VS.RSCP.Mean.TP6.9(dBm)'or data.columns.values[31] != 'VS.RSCP.Mean.TP10.15(dBm)'or data.columns.values[32] != 'VS.RSCP.Mean.TP16.25(dBm)'or data.columns.values[33] != 'VS.RSCP.Mean.TP26.35(dBm)'or data.columns.values[34] != 'VS.RSCP.Mean.TP36.55(dBm)'or data.columns.values[35] != 'VS.RSCP.Mean.TP.More55(dBm)'):
print('Data file is not according to template')
sys.exit()
if (len(ept.columns) != 4 or ept.index.name != 'Cell_Name' or ept.columns.values[0] != 'Lon' or ept.columns.values[1] != 'Lat' or ept.columns.values[2] != 'Azimuth' or ept.columns.values[3] != 'Beamwidth'):
print('EPT file is not according to template')
sys.exit()
full_df = pd.concat([ept, data], axis=1, sort=True)
if not pd.Series(ept['Beamwidth']).between(0,359).all(): #If at least 1 value is out of range then fail
print('Beamwidth columns is out of range (Value should be between 0 and 359)')
sys.exit()
if not pd.Series(ept['Azimuth']).between(0,359).all(): #If at least 1 value is out of range then fail
print('Azimuth columns is out of range (Value should be between 0 and 359)')
sys.exit()
if full_df['Lon'].isnull().values.any() or full_df['Lat'].isnull().values.any(): #If at least 1 value is NaN then fail
print('There are cells not matching between tables')
sys.exit()
print('Validation succeed')
return full_df
| 97.114286
| 1,915
| 0.6599
| 611
| 3,399
| 3.641571
| 0.212766
| 0.233708
| 0.210337
| 0.307416
| 0.40764
| 0.137079
| 0.129438
| 0.129438
| 0.097978
| 0.097978
| 0
| 0.057153
| 0.140335
| 3,399
| 35
| 1,916
| 97.114286
| 0.704312
| 0.03707
| 0
| 0.222222
| 0
| 0
| 0.331397
| 0.128401
| 0
| 0
| 0
| 0
| 0
| 1
| 0.037037
| false
| 0
| 0.074074
| 0
| 0.148148
| 0.296296
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
07a3d38627eeff4ec7a8a09a8d91b008cebe0137
| 19,118
|
py
|
Python
|
models/old_project_tables.py
|
total-impact/software
|
9a61bf68cba9e95bbd2e2d5f0791ddf1746d2c99
|
[
"MIT"
] | 169
|
2015-10-13T01:42:57.000Z
|
2019-10-17T04:17:20.000Z
|
models/old_project_tables.py
|
resslerruntime/depsy
|
9a61bf68cba9e95bbd2e2d5f0791ddf1746d2c99
|
[
"MIT"
] | 111
|
2015-11-09T20:44:37.000Z
|
2018-11-27T20:10:13.000Z
|
models/old_project_tables.py
|
resslerruntime/depsy
|
9a61bf68cba9e95bbd2e2d5f0791ddf1746d2c99
|
[
"MIT"
] | 14
|
2015-11-10T23:08:25.000Z
|
2019-07-01T18:51:32.000Z
|
# CRAN
from app import db
from sqlalchemy.dialects.postgresql import JSONB
import requests
from models import github_api
from lxml import html
from util import elapsed
from time import time
import re
# class CranProject(db.Model):
# project_name = db.Column(db.Text, primary_key=True)
# owner_name = db.Column(db.Text)
# github_owner = db.Column(db.Text)
# github_repo_name = db.Column(db.Text)
# github_contributors = db.Column(JSONB)
# api_raw = db.Column(JSONB)
# downloads = db.Column(JSONB)
# reverse_deps = db.Column(JSONB)
# deps = db.Column(JSONB)
# proxy_papers = db.Column(db.Text)
# def __repr__(self):
# return u'<CranProject {project_name}>'.format(
# project_name=self.project_name)
# def set_api_raw(self):
# url_template = "http://crandb.r-pkg.org/%s"
# data_url = url_template % self.project_name
# print data_url
# response = requests.get(data_url)
# self.api_raw = response.json()
# def set_github_contributors(self):
# self.github_contributors = github_api.get_repo_contributors(
# self.github_owner,
# self.github_repo_name
# )
# print "added github contributors!"
# print self.github_contributors
# def set_downloads(self):
# url_template = "http://cranlogs.r-pkg.org/downloads/daily/1900-01-01:2020-01-01/%s"
# data_url = url_template % self.project_name
# print data_url
# response = requests.get(data_url)
# if "day" in response.text:
# data = {}
# all_days = response.json()[0]["downloads"]
# data["total_downloads"] = sum([int(day["downloads"]) for day in all_days])
# data["first_download"] = min([day["day"] for day in all_days])
# data["daily_downloads"] = all_days
# else:
# data = {"total_downloads": 0}
# self.downloads = data
# def set_github_repo(self):
# try:
# urls_str = self.api_raw['URL']
# except KeyError:
# return False
# # People put all kinds of lists in this field. So we're splitting on
# # newlines, commas, and spaces. Won't get everything, but will
# # get most.
# urls = re.compile(r",*\s*\n*").split(urls_str)
# for url in urls:
# login, repo_name = github_api.login_and_repo_name_from_url(url)
# if login and repo_name:
# self.github_repo_name = repo_name
# self.github_owner = login
# # there may be more than one github url. if so, too bad,
# # we're just picking the first one.
# break
# print "successfully set a github ID for {name}: {login}/{repo_name}.".format(
# name=self.project_name,
# login=self.github_owner,
# repo_name=self.github_repo_name
# )
# def set_reverse_depends(self):
# url_template = "https://cran.r-project.org/web/packages/%s/"
# data_url = url_template % self.project_name
# print data_url
# # this call keeps timing out for some reason. quick workaround:
# response = None
# while not response:
# try:
# response = requests.get(data_url)
# except requests.exceptions.ConnectionError:
# # try again
# print "connection timed out, trying again"
# pass
# if "Reverse" in response.text:
# page = response.text
# page = page.replace(" ", " ") # otherwise starts-with for lxml doesn't work
# tree = html.fromstring(page)
# data = {}
# data["reverse_imports"] = tree.xpath('//tr[(starts-with(td[1], "Reverse imports"))]/td[2]/a/text()')
# data["reverse_depends"] = tree.xpath('//tr[(starts-with(td[1], "Reverse depends"))]/td[2]/a/text()')
# data["reverse_suggests"] = tree.xpath('//tr[(starts-with(td[1], "Reverse suggests"))]/td[2]/a/text()')
# data["reverse_enhances"] = tree.xpath('//tr[(starts-with(td[1], "Reverse enhances"))]/td[2]/a/text()')
# all_reverse_deps = set(data["reverse_imports"] + data["reverse_depends"] + data["reverse_suggests"] + data["reverse_enhances"])
# data["all_reverse_deps"] = list(all_reverse_deps)
# else:
# data = {"all_reverse_deps": []}
# self.reverse_deps = data
# def set_proxy_papers(self):
# url_template = "https://cran.r-project.org/web/packages/%s/citation.html"
# data_url = url_template % self.project_name
# print data_url
# response = requests.get(data_url, timeout=30)
# if response and response.status_code==200 and "<pre>" in response.text:
# page = response.text
# tree = html.fromstring(page)
# proxy_papers = str(tree.xpath('//pre/text()'))
# print proxy_papers
# else:
# print "no proxy paper found"
# proxy_papers = "No proxy paper"
# self.proxy_papers = proxy_papers
# """
# add cran download stats
# """
# def add_cran_downloads(project_name):
# project = db.session.query(CranProject).get(project_name)
# project.set_downloads()
# if project.downloads:
# print "got downloads!"
# db.session.commit()
# # print u"download data found: {}".format(project.downloads)
# def add_all_cran_downloads():
# q = db.session.query(CranProject.project_name)
# q = q.filter(CranProject.downloads == "null")
# q = q.order_by(CranProject.project_name)
# for row in q.all():
# add_cran_downloads(row[0])
# """
# add cran reverse_deps
# """
# def add_cran_reverse_deps(project_name):
# project = db.session.query(CranProject).get(project_name)
# project.set_reverse_depends()
# if project.reverse_deps:
# print "got reverse_deps!"
# db.session.commit()
# print u"data found: {}".format(project.reverse_deps)
# def add_all_cran_reverse_deps():
# q = db.session.query(CranProject.project_name)
# q = q.filter(CranProject.reverse_deps == "null")
# q = q.order_by(CranProject.project_name)
# for row in q.all():
# add_cran_reverse_deps(row[0])
# """
# add cran about
# """
# def add_cran_about(project_name):
# project = db.session.query(CranProject).get(project_name)
# project.set_api_raw()
# if project.api_raw:
# print "got api_raw!"
# db.session.commit()
# print u"data found: {}".format(project.api_raw)
# def add_all_cran_about():
# q = db.session.query(CranProject.project_name)
# q = q.filter(CranProject.api_raw == "null")
# q = q.order_by(CranProject.project_name)
# for row in q.all():
# add_cran_about(row[0])
# """
# add cran proxy papers
# """
# def add_cran_proxy_papers(project_name):
# project = db.session.query(CranProject).get(project_name)
# project.set_proxy_papers()
# db.session.commit()
# def add_all_cran_proxy_papers():
# q = db.session.query(CranProject.project_name)
# q = q.filter(CranProject.proxy_papers == None)
# q = q.order_by(CranProject.project_name)
# for row in q.all():
# add_cran_proxy_papers(row[0])
# """
# set cran github info
# """
# def set_all_cran_github_ids():
# q = db.session.query(CranProject.project_name)
# q = q.filter(CranProject.api_raw.has_key("URL")) # if there's no url, there's no github url.
# q = q.order_by(CranProject.project_name)
# update_fn = make_update_fn("set_github_repo")
# for row in q.all():
# update_fn(row[0])
# """
# get github contrib info
# """
# def set_all_cran_github_contributors():
# q = db.session.query(CranProject.project_name)
# q = q.filter(CranProject.github_repo_name != None)
# q = q.order_by(CranProject.project_name)
# update_fn = make_update_fn("set_github_contributors")
# for row in q.all():
# update_fn(row[0])
# def make_update_fn(method_name):
# def fn(obj_id):
# start_time = time()
# obj = db.session.query(CranProject).get(obj_id)
# if obj is None:
# return None
# method_to_run = getattr(obj, method_name)
# method_to_run()
# db.session.commit()
# print "ran {repr}.{method_name}() method and committed. took {elapsted}sec".format(
# repr=obj,
# method_name=method_name,
# elapsted=elapsed(start_time, 4)
# )
# return None # important for if we use this on RQ
# return fn
# def test_cran_project():
# print "testing cran project!"
# PYPI
# from app import db
# from sqlalchemy.dialects.postgresql import JSONB
# from models import github_api
# import requests
# import re
# import pickle
# from pathlib import Path
# from time import time
# from util import elapsed
# # set to nothing most of the time, so imports work
# pypi_package_names = None
# # comment this out here now, because usually not using
# #pypi_package_names = get_pypi_package_names()
# class PypiProject(db.Model):
# project_name = db.Column(db.Text, primary_key=True)
# owner_name = db.Column(db.Text)
# github_owner = db.Column(db.Text)
# github_repo_name = db.Column(db.Text)
# github_contributors = db.Column(JSONB)
# api_raw = db.Column(JSONB)
# reverse_deps = db.Column(JSONB)
# deps = db.Column(JSONB)
# zip_download_elapsed = db.Column(db.Float)
# zip_download_size = db.Column(db.Integer)
# zip_download_error = db.Column(db.Text)
# #dependency_lines = db.Column(db.Text)
# #zip_grep_elapsed = db.Column(db.Float)
# def __repr__(self):
# return u'<PypiProject {project_name}>'.format(
# project_name=self.project_name)
# @property
# def language(self):
# return "python"
# def set_github_contributors(self):
# self.github_contributors = github_api.get_repo_contributors(
# self.github_owner,
# self.github_repo_name
# )
# print "added github contributors!"
# print self.github_contributors
# #def set_dependency_lines(self):
# # getter = github_zip_getter_factory(self.login, self.repo_name)
# # getter.get_dep_lines(self.language)
# #
# # self.dependency_lines = getter.dep_lines
# # self.zip_download_elapsed = getter.download_elapsed
# # self.zip_download_size = getter.download_kb
# # self.zip_download_error = getter.error
# # self.zip_grep_elapsed = getter.grep_elapsed
# #
# # return self.dependency_lines
# #
# #
# #def zip_getter(self):
# # if not self.api_raw:
# # return None
# # if not "url" in self.api_raw:
# # return None
# #
# # url = self.api_raw["url"]
# # getter = ZipGetter(url)
# # return getter
# """
# add pypi dependency lines
# """
# def add_pypi_dependency_lines(project_name):
# project = db.session.query(PypiProject).get(project_name)
# if project is None:
# print "there's no pypi project called {}".format(project_name)
# return False
# project.set_dependency_lines()
# db.session.commit()
# def add_all_pypi_dependency_lines():
# q = db.session.query(PypiProject.project_name)
# q = q.filter(~PypiProject.api_raw.has_key('error_code'))
# q = q.filter(PypiProject.dependency_lines == None,
# PypiProject.zip_download_error == None,
# PypiProject.zip_download_elapsed == None)
# q = q.order_by(PypiProject.project_name)
# for row in q.all():
# #print "setting this row", row
# add_pypi_dependency_lines(row[0], row[1])
# """
# get github contrib info
# """
# def set_all_pypi_github_contributors(limit=100):
# q = db.session.query(PypiProject.project_name)
# q = q.filter(PypiProject.github_repo_name != None)
# q = q.filter(PypiProject.github_contributors == None)
# q = q.order_by(PypiProject.project_name)
# q = q.limit(limit)
# update_fn = make_update_fn("set_github_contributors")
# for row in q.all():
# update_fn(row[0])
# def make_update_fn(method_name):
# def fn(obj_id):
# start_time = time()
# obj = db.session.query(PypiProject).get(obj_id)
# if obj is None:
# return None
# method_to_run = getattr(obj, method_name)
# method_to_run()
# db.session.commit()
# print "ran {repr}.{method_name}() method and committed. took {elapsted}sec".format(
# repr=obj,
# method_name=method_name,
# elapsted=elapsed(start_time, 4)
# )
# return None # important for if we use this on RQ
# return fn
# PYPI REPO
# from __future__ import division
# from app import db
# from models.github_api import make_ratelimited_call
# from models.github_api import GithubRateLimitException
# from models.github_user import GithubUser
# from util import elapsed
# from urlparse import urlparse
# import json
# from sqlalchemy.dialects.postgresql import JSON
# from sqlalchemy.sql.expression import func
# from sqlalchemy.exc import IntegrityError
# from sqlalchemy.exc import OperationalError
# from time import time
# def get_github_homepage(url):
# try:
# parsed = urlparse(url)
# except AttributeError:
# return None # no url was given
# # we are getting rid of things that
# # 1. aren't on github (duh)
# # 2. are just "github.com"
# # this leaves some things that have multiple pypi project in one github repo
# if parsed.netloc == "github.com" and len(parsed.path.split("/")) > 1:
# return url
# else:
# return None
# def make_pypi_repo(pypi_dict):
# # this is out of date and no longer will work...
# name = pypi_dict["info"]["name"]
# github_url = get_github_homepage(pypi_dict["info"]["home_page"])
# # i'm pretty sure this will break when you give it None, fix later.
# path = urlparse(github_url).path
# return PyPiRepo(
# pypi_name=name,
# repo_owner=path[1],
# repo_name=path[2],
# github_url=github_url,
# pypi_about=json.dumps(pypi_dict, indent=3, sort_keys=True)
# )
# # class PyPiRepo(db.Model):
# # __tablename__ = 'pypi_repo'
# # pypi_name = db.Column(db.Text, primary_key=True)
# # github_url = db.Column(db.Text)
# # repo_name = db.Column(db.Text)
# # repo_owner = db.Column(db.Text)
# # commit_counts = db.Column(JSON)
# # commit_percents = db.Column(JSON)
# # key_committers = db.Column(JSON)
# # is_404 = db.Column(db.Boolean)
# # pypi_about = db.deferred(db.Column(db.Text))
# # github_about = db.deferred(db.Column(JSON))
# # #collected = db.Column(db.DateTime())
# # #downloads_last_month = db.Column(db.Integer)
# # #downloads_ever = db.Column(db.Integer)
# # #requires = db.Column(JSON)
# # @property
# # def name_tuple(self):
# # return (self.repo_owner, self.repo_name)
# # def set_repo_commits(self):
# # url = "https://api.github.com/repos/{username}/{repo_name}/contributors?per_page=100".format(
# # username=self.repo_owner,
# # repo_name=self.repo_name
# # )
# # resp = make_ratelimited_call(url)
# # if resp is None:
# # self.is_404 = True
# # return False
# # # set the commit_lines property
# # self.commit_counts = {}
# # for contrib_dict in resp:
# # contrib_login = contrib_dict["login"]
# # self.commit_counts[contrib_login] = contrib_dict["contributions"]
# # # set the commit_percents property
# # total_commits = sum(self.commit_counts.values())
# # self.commit_percents = {}
# # for username, count in self.commit_counts.iteritems():
# # self.commit_percents[username] = int(round(count / total_commits * 100))
# # # set the key_committer property
# # # do later.
# # self.key_committers = {}
# # for username, count in self.commit_counts.iteritems():
# # percent = self.commit_percents[username]
# # if percent >= 25 or count >= 100:
# # self.key_committers[username] = True
# # else:
# # self.key_committers[username] = False
# # return True
# def save_all_repo_owners_and_key_committers():
# start = time()
# q = db.session.query(PyPiRepo.repo_owner)\
# .filter(PyPiRepo.repo_owner.isnot(None))\
# .filter(PyPiRepo.is_404.isnot(True))
# logins = set()
# for res in q.all():
# logins.add(res[0])
# print "got {} logins from repo owners".format(len(logins))
# q2 = db.session.query(PyPiRepo.key_committers)\
# .filter(PyPiRepo.key_committers.isnot(None))\
# .filter(PyPiRepo.is_404.isnot(True))
# for res in q2.all():
# for login, is_key in res[0].iteritems():
# if is_key:
# logins.add(login)
# print "got {} logins including key committers".format(len(logins))
# index = 0
# for login in logins:
# user = GithubUser(login=login)
# db.session.add(user)
# print "{}: {}".format(index, login)
# index += 1
# if index % 100 == 0:
# print "flushing to db...\n\n"
# db.session.flush()
# db.session.commit()
# return True
# def set_all_repo_commits():
# start = time()
# index = 0
# q = db.session.query(PyPiRepo)\
# .filter(PyPiRepo.repo_name.isnot(None))\
# .filter(PyPiRepo.repo_owner.isnot(None))\
# .filter(PyPiRepo.is_404.isnot(True))\
# .filter(PyPiRepo.commit_counts.is_(None))\
# .limit(5000)
# for repo in q.yield_per(100):
# try:
# repo.set_repo_commits()
# index += 1
# print "#{index} ({sec}sec): ran set_repo_commits() for {owner}/{name}".format(
# index=index,
# sec=elapsed(start),
# owner=repo.repo_owner,
# name=repo.repo_name
# )
# except GithubRateLimitException:
# print "ran out of api keys. committing...\n\n".format(
# num=index,
# sec=elapsed(start)
# )
# db.session.commit()
# return False
# if index % 100 == 0:
# try:
# db.session.flush()
# except OperationalError:
# print "problem with flushing the session. rolling back."
# db.session.rollback()
# continue
# print "finished updating repos! committing...".format(
# num=index,
# sec=elapsed(start)
# )
# db.session.commit()
# return True
| 29.594427
| 141
| 0.60273
| 2,382
| 19,118
| 4.640638
| 0.146096
| 0.039805
| 0.020807
| 0.020264
| 0.438936
| 0.384567
| 0.350552
| 0.344219
| 0.304143
| 0.294192
| 0
| 0.007151
| 0.268543
| 19,118
| 645
| 142
| 29.64031
| 0.783324
| 0.9263
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
07b5578f06f6bd641523184cc661a92f74c5f35f
| 232
|
py
|
Python
|
contrib_src/run.py
|
modelhub-ai/ResNet-50
|
a08e5b7efe465e2411673f30291231bf93c5112b
|
[
"Apache-2.0"
] | 12
|
2019-02-03T17:57:14.000Z
|
2022-02-24T19:56:26.000Z
|
contrib_src/run.py
|
modelhub-ai/ResNet-50
|
a08e5b7efe465e2411673f30291231bf93c5112b
|
[
"Apache-2.0"
] | 1
|
2019-05-28T03:29:05.000Z
|
2019-06-11T14:51:37.000Z
|
contrib_src/run.py
|
modelhub-ai/ResNet-50
|
a08e5b7efe465e2411673f30291231bf93c5112b
|
[
"Apache-2.0"
] | 9
|
2018-10-05T18:20:06.000Z
|
2021-06-16T08:54:23.000Z
|
import os
from modelhubapi import webservice
from inference import Model
if __name__ == "__main__":
model = Model()
contrib_src_dir = os.path.dirname(os.path.realpath(__file__))
webservice.start(model, contrib_src_dir)
| 25.777778
| 65
| 0.758621
| 31
| 232
| 5.16129
| 0.580645
| 0.15
| 0.1875
| 0.225
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.150862
| 232
| 8
| 66
| 29
| 0.812183
| 0
| 0
| 0
| 0
| 0
| 0.034483
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.428571
| 0
| 0.428571
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
07c264706103056a9989f36b1b3f365f7c1d47ce
| 1,191
|
py
|
Python
|
tests/venv/test_utils.py
|
daobook/hatch
|
1cf39ad1a11ce90bc77fb7fdc4b9202433509179
|
[
"MIT"
] | null | null | null |
tests/venv/test_utils.py
|
daobook/hatch
|
1cf39ad1a11ce90bc77fb7fdc4b9202433509179
|
[
"MIT"
] | null | null | null |
tests/venv/test_utils.py
|
daobook/hatch
|
1cf39ad1a11ce90bc77fb7fdc4b9202433509179
|
[
"MIT"
] | null | null | null |
from hatch.venv.utils import get_random_venv_name, handle_verbosity_flag
class TestGetRandomVenvName:
def test_length(self):
assert len(get_random_venv_name()) == 4
def test_different(self):
assert get_random_venv_name() != get_random_venv_name()
class TestHandleVerbosityFlag:
def test_default_quiet(self):
command = ['virtualenv', 'foo']
handle_verbosity_flag(command, 0)
assert command == ['virtualenv', 'foo', '-q']
def test_single_quiet_same_as_default(self):
command = ['virtualenv', 'foo']
handle_verbosity_flag(command, -1)
assert command == ['virtualenv', 'foo', '-q']
def test_single_verbose_normal(self):
command = ['virtualenv', 'foo']
handle_verbosity_flag(command, 1)
assert command == ['virtualenv', 'foo']
def test_multiple_quiet(self):
command = ['virtualenv', 'foo']
handle_verbosity_flag(command, -2)
assert command == ['virtualenv', 'foo', '-qq']
def test_multiple_verbose(self):
command = ['virtualenv', 'foo']
handle_verbosity_flag(command, 2)
assert command == ['virtualenv', 'foo', '-vv']
| 28.357143
| 72
| 0.643997
| 133
| 1,191
| 5.466165
| 0.293233
| 0.233838
| 0.275103
| 0.165062
| 0.580468
| 0.580468
| 0.580468
| 0.580468
| 0.50619
| 0.423659
| 0
| 0.006501
| 0.225021
| 1,191
| 41
| 73
| 29.04878
| 0.781148
| 0
| 0
| 0.259259
| 0
| 0
| 0.117548
| 0
| 0
| 0
| 0
| 0
| 0.259259
| 1
| 0.259259
| false
| 0
| 0.037037
| 0
| 0.37037
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
07df075f9cbaec6e41a2f3b383a030f089370b6d
| 659
|
py
|
Python
|
investing_algorithm_framework/views/__init__.py
|
investing-algorithms/investing-algorithm-framework
|
d579e142a3857e2e2dfb59b7d6e54202f7df5466
|
[
"Apache-2.0"
] | 1
|
2019-12-23T21:23:45.000Z
|
2019-12-23T21:23:45.000Z
|
investing_algorithm_framework/views/__init__.py
|
investing-algorithms/investing-algorithm-framework
|
d579e142a3857e2e2dfb59b7d6e54202f7df5466
|
[
"Apache-2.0"
] | null | null | null |
investing_algorithm_framework/views/__init__.py
|
investing-algorithms/investing-algorithm-framework
|
d579e142a3857e2e2dfb59b7d6e54202f7df5466
|
[
"Apache-2.0"
] | 1
|
2019-12-23T21:23:50.000Z
|
2019-12-23T21:23:50.000Z
|
from investing_algorithm_framework import current_app
from investing_algorithm_framework.views.order_views import blueprint \
as order_views_blueprint
from investing_algorithm_framework.views.portfolio_views import blueprint \
as portfolio_views_blueprint
from investing_algorithm_framework.views.position_views import blueprint \
as position_views_blueprint
from .operational_views import blueprint as operational_views_blueprint
app = current_app
app.register_blueprint(operational_views_blueprint)
app.register_blueprint(order_views_blueprint)
app.register_blueprint(position_views_blueprint)
app.register_blueprint(portfolio_views_blueprint)
| 43.933333
| 75
| 0.887709
| 82
| 659
| 6.719512
| 0.182927
| 0.203267
| 0.15971
| 0.225045
| 0.431942
| 0.181488
| 0.181488
| 0
| 0
| 0
| 0
| 0
| 0.07739
| 659
| 14
| 76
| 47.071429
| 0.90625
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.384615
| 0
| 0.384615
| 0.846154
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
|
0
| 4
|
07eac2d7bce47e5fb647a61e687fcdf4a4738010
| 628
|
py
|
Python
|
sslic/losses/general.py
|
gergopool/ssl
|
676d01b88a50acea9a3b6c406fc4b82de74ec7b3
|
[
"MIT"
] | 1
|
2022-02-05T13:49:17.000Z
|
2022-02-05T13:49:17.000Z
|
sslic/losses/general.py
|
gergopool/ssl
|
676d01b88a50acea9a3b6c406fc4b82de74ec7b3
|
[
"MIT"
] | null | null | null |
sslic/losses/general.py
|
gergopool/ssl
|
676d01b88a50acea9a3b6c406fc4b82de74ec7b3
|
[
"MIT"
] | null | null | null |
import torch
from torch import nn
class Loss(nn.Module):
def __init__(self, emb_dim: int = -1):
super().__init__()
self.emb_dim = emb_dim
@classmethod
def imagenet(cls, *args, **kwargs):
return cls(*args, *kwargs)
@classmethod
def tiny_imagenet(cls, *args, **kwargs):
return cls(*args, *kwargs)
@classmethod
def cifar10(cls, *args, **kwargs):
return cls(*args, *kwargs)
@classmethod
def cifar100(cls, *args, **kwargs):
return cls(*args, *kwargs)
def forward(self, x: torch.Tensor) -> torch.Tensor:
raise NotImplementedError
| 21.655172
| 55
| 0.609873
| 75
| 628
| 4.946667
| 0.386667
| 0.150943
| 0.280323
| 0.204852
| 0.501348
| 0.501348
| 0.501348
| 0.415094
| 0.415094
| 0.291105
| 0
| 0.012876
| 0.257962
| 628
| 28
| 56
| 22.428571
| 0.783262
| 0
| 0
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.3
| false
| 0
| 0.1
| 0.2
| 0.65
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
07ed1ace2d17269b9e46e6b1160843b723088b6c
| 55
|
py
|
Python
|
packages/pytea/pylib/shutil.py
|
Sehun0819/pytea
|
3f068016a71a1915722e51d977fedab01427a42c
|
[
"MIT"
] | 241
|
2021-03-19T01:11:44.000Z
|
2022-03-25T03:15:22.000Z
|
packages/pytea/pylib/shutil.py
|
Sehun0819/pytea
|
3f068016a71a1915722e51d977fedab01427a42c
|
[
"MIT"
] | 2
|
2021-02-26T08:16:04.000Z
|
2022-02-28T02:52:58.000Z
|
packages/pytea/pylib/shutil.py
|
Sehun0819/pytea
|
3f068016a71a1915722e51d977fedab01427a42c
|
[
"MIT"
] | 14
|
2021-01-08T02:22:58.000Z
|
2022-01-19T14:13:14.000Z
|
def copyfile(src, dst, follow_symlinks=True):
pass
| 18.333333
| 45
| 0.727273
| 8
| 55
| 4.875
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.163636
| 55
| 2
| 46
| 27.5
| 0.847826
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
07f48e32355d335480a618664ccb2995733eb200
| 89
|
py
|
Python
|
monthly/apps.py
|
Moizes92/CTMS
|
faceaf71a6fd6fb379dbcc13a60a538e449e13db
|
[
"Apache-2.0"
] | null | null | null |
monthly/apps.py
|
Moizes92/CTMS
|
faceaf71a6fd6fb379dbcc13a60a538e449e13db
|
[
"Apache-2.0"
] | null | null | null |
monthly/apps.py
|
Moizes92/CTMS
|
faceaf71a6fd6fb379dbcc13a60a538e449e13db
|
[
"Apache-2.0"
] | null | null | null |
from django.apps import AppConfig
class MonthlyConfig(AppConfig):
name = 'monthly'
| 14.833333
| 33
| 0.752809
| 10
| 89
| 6.7
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.168539
| 89
| 5
| 34
| 17.8
| 0.905405
| 0
| 0
| 0
| 0
| 0
| 0.078652
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6afa4b34894f8acccc20c7573a2825e46b50d981
| 96
|
py
|
Python
|
flow_manage/apps.py
|
LipotesOps/octo-fibula
|
14c7a2b5e4929c9f441f81485949d91ef9ab66a0
|
[
"MIT"
] | 1
|
2020-12-23T06:14:27.000Z
|
2020-12-23T06:14:27.000Z
|
flow_manage/apps.py
|
LipotesOps/octo-fibula
|
14c7a2b5e4929c9f441f81485949d91ef9ab66a0
|
[
"MIT"
] | 7
|
2020-06-06T01:58:04.000Z
|
2022-02-10T14:02:38.000Z
|
flow_manage/apps.py
|
LipotesOps/octo-fibula
|
14c7a2b5e4929c9f441f81485949d91ef9ab66a0
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class FlowManageConfig(AppConfig):
name = 'flow_manage'
| 16
| 34
| 0.770833
| 11
| 96
| 6.636364
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15625
| 96
| 5
| 35
| 19.2
| 0.901235
| 0
| 0
| 0
| 0
| 0
| 0.114583
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6afc738310a35f2021a52b95c51ade0881c450f5
| 1,013
|
py
|
Python
|
Programa_4_hoja_de_trabajo_11_de_agosto.py
|
Salazar769/Ciclo-1-python
|
faccc2e8cb12c863f4818d8152350129e7306df5
|
[
"CC0-1.0"
] | null | null | null |
Programa_4_hoja_de_trabajo_11_de_agosto.py
|
Salazar769/Ciclo-1-python
|
faccc2e8cb12c863f4818d8152350129e7306df5
|
[
"CC0-1.0"
] | null | null | null |
Programa_4_hoja_de_trabajo_11_de_agosto.py
|
Salazar769/Ciclo-1-python
|
faccc2e8cb12c863f4818d8152350129e7306df5
|
[
"CC0-1.0"
] | null | null | null |
"""Realizr una programa para crear la clase Calcular, ingresa los atributos
necesarios. Utilice el método constructor. Agregaremos el soporte
adecuado para operaciones matemáticas del atributo utilizando la
sobrecarga de operadores.
Realizar la sobrecarga de operadores de multiplicación, resta,
división y modulo.
Recuerde que todos los métodos se muestran por medio del objeto, se
muestran los resultados obtenidos"""
class Calcular:
def __init__(self, a_1):
self.a_1 = a_1
def __mul__(self, num_2):
return self.a_1 * num_2
def __sub__(self,num_2):
return self.a_1 - num_2
def __divmod__(self, num_2):
return self.a_1 / num_2
def __mod__(self, num_2):
return self.a_1 % num_2
calc = Calcular(5)
print("El valor de la multiplicación es: ", calc * 12)
print("El valor de la resta es: ", calc - 23)
print("El valor de la división es: ", calc / 2)
print("El valor del modulo es igual a: ", calc % 7)
| 31.65625
| 76
| 0.677196
| 153
| 1,013
| 4.254902
| 0.431373
| 0.049155
| 0.0553
| 0.086022
| 0.235023
| 0.16129
| 0.16129
| 0.16129
| 0.16129
| 0.124424
| 0
| 0.028871
| 0.247779
| 1,013
| 31
| 77
| 32.677419
| 0.825459
| 0.419546
| 0
| 0
| 0
| 0
| 0.216364
| 0
| 0
| 0
| 0
| 0.064516
| 0
| 1
| 0.3125
| false
| 0
| 0
| 0.25
| 0.625
| 0.25
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
ed0a2da29c60e0e05486bcc135325367aafae825
| 260
|
py
|
Python
|
domain/model/base/entity.py
|
agiledragon/transfer-money-python
|
a8f7520c37f75e098623e58e269d3fccf11cb205
|
[
"MIT"
] | 5
|
2019-08-07T05:53:39.000Z
|
2021-11-18T07:02:02.000Z
|
domain/model/base/entity.py
|
agiledragon/transfer-money-python
|
a8f7520c37f75e098623e58e269d3fccf11cb205
|
[
"MIT"
] | null | null | null |
domain/model/base/entity.py
|
agiledragon/transfer-money-python
|
a8f7520c37f75e098623e58e269d3fccf11cb205
|
[
"MIT"
] | 5
|
2019-08-07T05:53:53.000Z
|
2020-05-18T16:45:54.000Z
|
class Entity(object):
def __init__(self, id):
self._id = id
def __eq__(self, other):
return self.id == other.id
def __ne__(self, other):
return not self == other
@property
def id(self):
return self._id
| 15.294118
| 34
| 0.561538
| 34
| 260
| 3.882353
| 0.382353
| 0.181818
| 0.227273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.330769
| 260
| 16
| 35
| 16.25
| 0.758621
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0
| 0.3
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
ed2e629f4c77c9932c34a00356125d1ad04e6bcc
| 1,135
|
py
|
Python
|
netket/utils/dispatch.py
|
pesvut/netket
|
7f19574ddc567748344bb75a4ddd507578d94b0d
|
[
"Apache-2.0"
] | null | null | null |
netket/utils/dispatch.py
|
pesvut/netket
|
7f19574ddc567748344bb75a4ddd507578d94b0d
|
[
"Apache-2.0"
] | 26
|
2021-08-06T15:27:57.000Z
|
2022-03-30T16:55:18.000Z
|
netket/utils/dispatch.py
|
pesvut/netket
|
7f19574ddc567748344bb75a4ddd507578d94b0d
|
[
"Apache-2.0"
] | 1
|
2020-01-14T11:39:00.000Z
|
2020-01-14T11:39:00.000Z
|
# Copyright 2021 The NetKet Authors - All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from plum import dispatch, parametric, convert # noqa: F401
# A simple type to represent a compile-constant True/False type
class Bool:
"""A class representing a static True/False that can be used for dispatch."""
pass
class TrueT(Bool):
"""A class representing a static True value that can be used for dispatch."""
def __bool__(self):
return True
class FalseT(Bool):
"""A class representing a static False value that can be used for dispatch."""
def __bool__(self):
return False
| 30.675676
| 82
| 0.729515
| 171
| 1,135
| 4.795322
| 0.561404
| 0.073171
| 0.036585
| 0.080488
| 0.257317
| 0.257317
| 0.192683
| 0.112195
| 0.112195
| 0.112195
| 0
| 0.012101
| 0.199119
| 1,135
| 36
| 83
| 31.527778
| 0.889989
| 0.764758
| 0
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0.111111
| 0.111111
| 0.222222
| 0.888889
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
ed401acdd7484619e8ca1b1897c790739b13b46b
| 160
|
py
|
Python
|
ssseg/modules/models/segmentors/maskformer/transformers/__init__.py
|
zhizhangxian/sssegmentation
|
90613f6e0abf4cdd729cf382ab2a915e106d8649
|
[
"MIT"
] | 41
|
2021-08-28T01:29:19.000Z
|
2022-03-30T11:28:37.000Z
|
ssseg/modules/models/segmentors/maskformer/transformers/__init__.py
|
zhizhangxian/sssegmentation
|
90613f6e0abf4cdd729cf382ab2a915e106d8649
|
[
"MIT"
] | 6
|
2021-08-31T08:54:39.000Z
|
2021-11-02T10:45:47.000Z
|
ssseg/modules/models/segmentors/maskformer/transformers/__init__.py
|
zhizhangxian/sssegmentation
|
90613f6e0abf4cdd729cf382ab2a915e106d8649
|
[
"MIT"
] | 1
|
2021-09-08T01:41:10.000Z
|
2021-09-08T01:41:10.000Z
|
'''initialize'''
from .predictor import Predictor
from .criterion import SetCriterion
from .transformer import Transformer
from .matcher import HungarianMatcher
| 32
| 37
| 0.8375
| 17
| 160
| 7.882353
| 0.529412
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 160
| 5
| 37
| 32
| 0.930556
| 0.0625
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
ed4c42b0e4b1052de914e425fc743f03c33ed1b8
| 636
|
py
|
Python
|
Configuration/Eras/python/Era_Run2_2016_cff.py
|
depasse/cmssw
|
39428aba78dcfdbfa5bda6f5c1dfd9556ba10755
|
[
"Apache-2.0"
] | null | null | null |
Configuration/Eras/python/Era_Run2_2016_cff.py
|
depasse/cmssw
|
39428aba78dcfdbfa5bda6f5c1dfd9556ba10755
|
[
"Apache-2.0"
] | null | null | null |
Configuration/Eras/python/Era_Run2_2016_cff.py
|
depasse/cmssw
|
39428aba78dcfdbfa5bda6f5c1dfd9556ba10755
|
[
"Apache-2.0"
] | null | null | null |
import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Modifier_run2_common_cff import run2_common
from Configuration.Eras.Modifier_run2_25ns_specific_cff import run2_25ns_specific
from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger
from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016
from Configuration.Eras.Modifier_run2_HLTconditions_2016_cff import run2_HLTconditions_2016
from Configuration.Eras.Modifier_run2_muon_2016_cff import run2_muon_2016
Run2_2016 = cms.ModifierChain(run2_common, run2_25ns_specific,
stage2L1Trigger, ctpps_2016, run2_HLTconditions_2016, run2_muon_2016)
| 48.923077
| 91
| 0.900943
| 88
| 636
| 6.090909
| 0.238636
| 0.190299
| 0.235075
| 0.324627
| 0.261194
| 0.13806
| 0
| 0
| 0
| 0
| 0
| 0.10906
| 0.062893
| 636
| 12
| 92
| 53
| 0.790268
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.777778
| 0
| 0.777778
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
ed5bf391394795e4b16a1a4e7e9f7ddd81508d35
| 119
|
py
|
Python
|
pyleecan/Functions/copy.py
|
tobsen2code/pyleecan
|
5b1ded9e389e0c79ed7b7c878b6e939f2d9962e9
|
[
"Apache-2.0"
] | 95
|
2019-01-23T04:19:45.000Z
|
2022-03-17T18:22:10.000Z
|
pyleecan/Functions/copy.py
|
ecs-kev/pyleecan
|
1faedde4b24acc6361fa1fdd4e980eaec4ca3a62
|
[
"Apache-2.0"
] | 366
|
2019-02-20T07:15:08.000Z
|
2022-03-31T13:37:23.000Z
|
pyleecan/Functions/copy.py
|
ecs-kev/pyleecan
|
1faedde4b24acc6361fa1fdd4e980eaec4ca3a62
|
[
"Apache-2.0"
] | 74
|
2019-01-24T01:47:31.000Z
|
2022-02-25T05:44:42.000Z
|
def copy(self, **kwargs):
"""Return a copy of the class"""
return type(self)(init_dict=self.as_dict(**kwargs))
| 29.75
| 55
| 0.655462
| 19
| 119
| 4
| 0.684211
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.159664
| 119
| 3
| 56
| 39.666667
| 0.76
| 0.218487
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
9c0feddfbc301c749a3cc4744a80189d3bf03147
| 73
|
py
|
Python
|
tests/mocks/__init__.py
|
ssichynskyi/web_metric_collection
|
3ec4907fb21bcb04526b193989e6dd073d55294b
|
[
"MIT"
] | null | null | null |
tests/mocks/__init__.py
|
ssichynskyi/web_metric_collection
|
3ec4907fb21bcb04526b193989e6dd073d55294b
|
[
"MIT"
] | null | null | null |
tests/mocks/__init__.py
|
ssichynskyi/web_metric_collection
|
3ec4907fb21bcb04526b193989e6dd073d55294b
|
[
"MIT"
] | null | null | null |
"""Mock implementations for testing of web_metric_collection package."""
| 36.5
| 72
| 0.808219
| 9
| 73
| 6.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.09589
| 73
| 1
| 73
| 73
| 0.863636
| 0.90411
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
9c2e0c1fe876db520546363f0c260c87e5c45df1
| 19,258
|
py
|
Python
|
main.py
|
ZHJ0125/bushu
|
8b223a9be273d7583425b6c851526de912d1ec05
|
[
"BSD-3-Clause"
] | 2
|
2022-03-21T14:40:35.000Z
|
2022-03-24T05:01:56.000Z
|
main.py
|
ZHJ0125/bushu
|
8b223a9be273d7583425b6c851526de912d1ec05
|
[
"BSD-3-Clause"
] | null | null | null |
main.py
|
ZHJ0125/bushu
|
8b223a9be273d7583425b6c851526de912d1ec05
|
[
"BSD-3-Clause"
] | null | null | null |
# -*- coding: utf8 -*-
from flask import Flask, render_template, request, flash, session, url_for, redirect
from flask_wtf import FlaskForm
from flask_sslify import SSLify
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired, Regexp
import time, json, random, re, requests
from urllib.parse import quote
app = Flask(__name__)
sslify = SSLify(app)
app.config["DEBUG"] = False
app.config['SECRET_KEY'] = 'ZHJ0125-bushu-dev'
name = 'ZHJ0125'
class MyForm(FlaskForm):
username = StringField('小米账号(手机号)', validators=[DataRequired(), Regexp('^1[35789]\d{9}$')], render_kw={'type':'number', 'class':"input", 'placeholder':"a"})
password = StringField('密码', validators=[DataRequired()], render_kw={'type':'password', 'class':"input", 'placeholder':"a"})
steps = StringField('步数(建议2000~40000)', validators=[DataRequired()], render_kw={'type':'number', 'class':"input", 'placeholder':"a"})
submit = SubmitField('提交', render_kw={'type':"submit", 'class':"submitBtn"})
# 根地址路由
@app.route('/', methods=['GET', 'POST'])
def index():
form = MyForm()
if request.method == 'POST':
if form.validate_on_submit():
# 数据格式正确,获取表单数据
# print("username = " + form.username.data)
# print("password = " + form.password.data)
# print("steps = " + form.steps.data)
# 验证步数范围
if(int(form.steps.data) <= 0 or int(form.steps.data) > 40000):
flash('步数超出范围,请重新输入步数', 'error')
return render_template('index.html', form=form)
flash('正在请求刷新步数,请稍等...')
form.submit.render_kw = {'type':"submit", 'class':"submitBtn_disable", 'disabled': 'disabled'} # 禁用submit
######### 调用 mimotion 项目的代码 #########
session['_flashes'].clear() # 清除所有闪现内容
result = SendMiRequest(form.username.data, form.password.data, form.steps.data)
if result[:7] == "[Error]":
type_of_message = "error"
else:
type_of_message = "message"
flash("🚩刷新步数成功!稍后可查看您的支付宝或微信步数", type_of_message)
# print(result)
flash(result, type_of_message)
############### 调用结束 ################
form.submit.render_kw = {'type':"submit", 'class':"submitBtn"} # 启用submit
else:
flash('输入的数据格式有误,请重新输入账号和密码', 'error') # 显示错误提示
return render_template('index.html', form=form)
# 默认GET请求,返回主页面
return render_template('index.html', form=form)
# 404页面处理
@app.errorhandler(404) # 传入要处理的错误代码
def page_not_found(e): # 接受异常对象作为参数
return render_template('404.html', user=name), 404 # 返回模板和状态码
# ------------------- 以下为 mimotion 项目的代码移植 --------------------
now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) # 当前时间
headers = { # API请求头
'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 9; MI 6 MIUI/20.6.18)'
}
def get_code(location):
"""
获取登录code
"""
code_pattern = re.compile("(?<=access=).*?(?=&)")
code = code_pattern.findall(location)[0]
return code
def login(_user, password):
"""
登录
"""
url1 = "https://api-user.huami.com/registrations/+86" + _user + "/tokens"
_headers = {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
"User-Agent": "MiFit/4.6.0 (iPhone; iOS 14.0.1; Scale/2.00)"
}
data1 = {
"client_id": "HuaMi",
"password": f"{password}",
"redirect_uri": "https://s3-us-west-2.amazonaws.com/hm-registration/successsignin.html",
"token": "access"
}
r1 = requests.post(url1, data=data1, headers=_headers, allow_redirects=False)
try:
location = r1.headers["Location"]
code = get_code(location)
except:
return 0, 0
# print("access_code获取成功!")
# print(code)
url2 = "https://account.huami.com/v2/client/login"
data2 = {
"app_name": "com.xiaomi.hm.health",
"app_version": "4.6.0",
"code": f"{code}",
"country_code": "CN",
"device_id": "2C8B4939-0CCD-4E94-8CBA-CB8EA6E613A1",
"device_model": "phone",
"grant_type": "access_token",
"third_name": "huami_phone",
}
r2 = requests.post(url2, data=data2, headers=_headers).json()
login_token = r2["token_info"]["login_token"]
# print("login_token获取成功!")
# print(login_token)
userid = r2["token_info"]["user_id"]
# print("userid获取成功!")
# print(userid)
return login_token, userid
def SendMiRequest(_user, _passwd, _step):
"""
主函数
"""
_user = str(_user)
password = str(_passwd)
_step = str(_step)
if _user == '' or password == '':
print("用户名或密码不能为空!")
return "[Error]:用户名或密码不能为空!"
if _step == '':
print("已设置为随机步数(10000-19999)")
_step = str(random.randint(10000, 19999))
login_token, userid = login(_user, password)
if login_token == 0:
print("登陆失败!")
return "[Error]:登陆失败,请检查用户名和密码"
t = get_time()
app_token = get_app_token(login_token)
today = time.strftime("%F")
summary = {
"v": 6,
"slp": {
"st": int(time.time()),
"ed": int(time.time()),
"dp": 0,
"lt": 0,
"wk": 0,
"usrSt": -1440,
"usrEd": -1440,
"wc": 0,
"is": 0,
"lb": 0,
"to": 0,
"dt": 0,
"rhr": 0,
"ss": 0
},
"stp": {
"ttl": _step,
"dis": 10627,
"cal": 510,
"wk": 41,
"rn": 50,
"runDist": 7654,
"runCal": 397,
"stage": [
{
"start": 327,
"stop": 341,
"mode": 1,
"dis": 481,
"cal": 13,
"step": 680
},
{
"start": 342,
"stop": 367,
"mode": 3,
"dis": 2295,
"cal": 95,
"step": 2874
},
{
"start": 368,
"stop": 377,
"mode": 4,
"dis": 1592,
"cal": 88,
"step": 1664
},
{
"start": 378,
"stop": 386,
"mode": 3,
"dis": 1072,
"cal": 51,
"step": 1245
},
{
"start": 387,
"stop": 393,
"mode": 4,
"dis": 1036,
"cal": 57,
"step": 1124
},
{
"start": 394,
"stop": 398,
"mode": 3,
"dis": 488,
"cal": 19,
"step": 607
},
{
"start": 399,
"stop": 414,
"mode": 4,
"dis": 2220,
"cal": 120,
"step": 2371
},
{
"start": 415,
"stop": 427,
"mode": 3,
"dis": 1268,
"cal": 59,
"step": 1489
},
{
"start": 428,
"stop": 433,
"mode": 1,
"dis": 152,
"cal": 4,
"step": 238
},
{
"start": 434,
"stop": 444,
"mode": 3,
"dis": 2295,
"cal": 95,
"step": 2874
},
{
"start": 445,
"stop": 455,
"mode": 4,
"dis": 1592,
"cal": 88,
"step": 1664
},
{
"start": 456,
"stop": 466,
"mode": 3,
"dis": 1072,
"cal": 51,
"step": 1245
},
{
"start": 467,
"stop": 477,
"mode": 4,
"dis": 1036,
"cal": 57,
"step": 1124
},
{
"start": 478,
"stop": 488,
"mode": 3,
"dis": 488,
"cal": 19,
"step": 607
},
{
"start": 489,
"stop": 499,
"mode": 4,
"dis": 2220,
"cal": 120,
"step": 2371
},
{
"start": 500,
"stop": 511,
"mode": 3,
"dis": 1268,
"cal": 59,
"step": 1489
},
{
"start": 512,
"stop": 522,
"mode": 1,
"dis": 152,
"cal": 4,
"step": 238
}
]
},
"goal": 8000,
"tz": "28800"
}
data_json = [
{
"data_hr": "//////9L////////////Vv///////////0v///////////9e/////0n/a///S////////////0b//////////1FK////////////R/////////////////9PTFFpaf9L////////////R////////////0j///////////9K////////////Ov///////////zf///86/zr/Ov88/zf/Pf///0v/S/8/////////////Sf///////////z3//////0r/Ov//////S/9L/zb/Sf9K/0v/Rf9H/zj/Sf9K/0//N////0D/Sf83/zr/Pf9M/0v/Ov9e////////////S////////////zv//z7/O/83/zv/N/83/zr/N/86/z//Nv83/zn/Xv84/zr/PP84/zj/N/9e/zr/N/89/03/P/89/z3/Q/9N/0v/Tv9C/0H/Of9D/zz/Of88/z//PP9A/zr/N/86/zz/Nv87/0D/Ov84/0v/O/84/zf/MP83/zH/Nv83/zf/N/84/zf/Of82/zf/OP83/zb/Mv81/zX/R/9L/0v/O/9I/0T/S/9A/zn/Pf89/zn/Nf9K/07/N/83/zn/Nv83/zv/O/9A/0H/Of8//zj/PP83/zj/S/87/zj/Nv84/zf/Of83/zf/Of83/zb/Nv9L/zj/Nv82/zb/N/85/zf/N/9J/zf/Nv83/zj/Nv84/0r/Sv83/zf/MP///zb/Mv82/zb/Of85/z7/Nv8//0r/S/85/0H/QP9B/0D/Nf89/zj/Ov83/zv/Nv8//0f/Sv9O/0ZeXv///////////1X///////////9B////////////TP///1b//////0////////////9N/////////v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+",
"date": today,
"data": [
{
"start": 0,
"stop": 1439,
"value": "UA8AUBQAUAwAUBoAUAEAYCcAUBkAUB4AUBgAUCAAUAEAUBkAUAwAYAsAYB8AYB0AYBgAYCoAYBgAYB4AUCcAUBsAUB8AUBwAUBIAYBkAYB8AUBoAUBMAUCEAUCIAYBYAUBwAUCAAUBgAUCAAUBcAYBsAYCUAATIPYD0KECQAYDMAYB0AYAsAYCAAYDwAYCIAYB0AYBcAYCQAYB0AYBAAYCMAYAoAYCIAYCEAYCYAYBsAYBUAYAYAYCIAYCMAUB0AUCAAUBYAUCoAUBEAUC8AUB0AUBYAUDMAUDoAUBkAUC0AUBQAUBwAUA0AUBsAUAoAUCEAUBYAUAwAUB4AUAwAUCcAUCYAUCwKYDUAAUUlEC8IYEMAYEgAYDoAYBAAUAMAUBkAWgAAWgAAWgAAWgAAWgAAUAgAWgAAUBAAUAQAUA4AUA8AUAkAUAIAUAYAUAcAUAIAWgAAUAQAUAkAUAEAUBkAUCUAWgAAUAYAUBEAWgAAUBYAWgAAUAYAWgAAWgAAWgAAWgAAUBcAUAcAWgAAUBUAUAoAUAIAWgAAUAQAUAYAUCgAWgAAUAgAWgAAWgAAUAwAWwAAXCMAUBQAWwAAUAIAWgAAWgAAWgAAWgAAWgAAWgAAWgAAWgAAWREAWQIAUAMAWSEAUDoAUDIAUB8AUCEAUC4AXB4AUA4AWgAAUBIAUA8AUBAAUCUAUCIAUAMAUAEAUAsAUAMAUCwAUBYAWgAAWgAAWgAAWgAAWgAAWgAAUAYAWgAAWgAAWgAAUAYAWwAAWgAAUAYAXAQAUAMAUBsAUBcAUCAAWwAAWgAAWgAAWgAAWgAAUBgAUB4AWgAAUAcAUAwAWQIAWQkAUAEAUAIAWgAAUAoAWgAAUAYAUB0AWgAAWgAAUAkAWgAAWSwAUBIAWgAAUC4AWSYAWgAAUAYAUAoAUAkAUAIAUAcAWgAAUAEAUBEAUBgAUBcAWRYAUA0AWSgAUB4AUDQAUBoAXA4AUA8AUBwAUA8AUA4AUA4AWgAAUAIAUCMAWgAAUCwAUBgAUAYAUAAAUAAAUAAAUAAAUAAAUAAAUAAAUAAAUAAAWwAAUAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAeSEAeQ8AcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcBcAcAAAcAAAcCYOcBUAUAAAUAAAUAAAUAAAUAUAUAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcCgAeQAAcAAAcAAAcAAAcAAAcAAAcAYAcAAAcBgAeQAAcAAAcAAAegAAegAAcAAAcAcAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcCkAeQAAcAcAcAAAcAAAcAwAcAAAcAAAcAIAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcCIAeQAAcAAAcAAAcAAAcAAAcAAAeRwAeQAAWgAAUAAAUAAAUAAAUAAAUAAAcAAAcAAAcBoAeScAeQAAegAAcBkAeQAAUAAAUAAAUAAAUAAAUAAAUAAAcAAAcAAAcAAAcAAAcAAAcAAAegAAegAAcAAAcAAAcBgAeQAAcAAAcAAAcAAAcAAAcAAAcAkAegAAegAAcAcAcAAAcAcAcAAAcAAAcAAAcAAAcA8AeQAAcAAAcAAAeRQAcAwAUAAAUAAAUAAAUAAAUAAAUAAAcAAAcBEAcA0AcAAAWQsAUAAAUAAAUAAAUAAAUAAAcAAAcAoAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAYAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcBYAegAAcAAAcAAAegAAcAcAcAAAcAAAcAAAcAAAcAAAeRkAegAAegAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAEAcAAAcAAAcAAAcAUAcAQAcAAAcBIAeQAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcBsAcAAAcAAAcBcAeQAAUAAAUAAAUAAAUAAAUAAAUBQAcBYAUAAAUAAAUAoAWRYAWTQAWQAAUAAAUAAAUAAAcAAAcAAAcAAAcAAAcAAAcAMAcAAAcAQAcAAAcAAAcAAAcDMAeSIAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcBQAeQwAcAAAcAAAcAAAcAMAcAAAeSoAcA8AcDMAcAYAeQoAcAwAcFQAcEMAeVIAaTYAbBcNYAsAYBIAYAIAYAIAYBUAYCwAYBMAYDYAYCkAYDcAUCoAUCcAUAUAUBAAWgAAYBoAYBcAYCgAUAMAUAYAUBYAUA4AUBgAUAgAUAgAUAsAUAsAUA4AUAMAUAYAUAQAUBIAASsSUDAAUDAAUBAAYAYAUBAAUAUAUCAAUBoAUCAAUBAAUAoAYAIAUAQAUAgAUCcAUAsAUCIAUCUAUAoAUA4AUB8AUBkAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAA",
"tz": 32,
"did": "DA932FFFFE8816E7",
"src": 24
}
],
"summary": json.dumps(summary),
"source": 24,
"type": 0
}
]
url = f'https://api-mifit-cn.huami.com/v1/data/band_data.json?&t={t}'
head = {
"apptoken": app_token,
"Content-Type": "application/x-www-form-urlencoded"
}
data = f'userid={userid}&last_sync_data_time=1597306380&device_type=0&last_deviceid=DA932FFFFE8816E7&data_json={quote(json.dumps(data_json))}'
response = requests.post(url, data=data, headers=head).json()
# print(response)
result = f"用户: {_user[:4]}****{_user[-4:]} \n时间: [{now}] \n修改步数: {_step}\n状态码: " + response['message']
print(result)
return result
def get_time():
"""
获取时间戳
"""
url = 'http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp'
response = requests.get(url, headers=headers).json()
t = response['data']['t']
return t
def get_app_token(login_token):
"""
获取app_token
"""
url = f"https://account-cn.huami.com/v1/client/app_tokens" \
f"?app_name=com.xiaomi.hm.health&dn=api-user.huami.com%2Capi-mifit.huami.com%2Capp-analytics.huami.com" \
f"&login_token={login_token}"
response = requests.get(url, headers=headers).json()
app_token = response['token_info']['app_token']
# print("app_token获取成功!")
# print(app_token)
return app_token
# ------------------- 以上为 mimotion 项目的代码移植 --------------------
# END_OF_FILE
| 50.545932
| 5,792
| 0.597518
| 1,494
| 19,258
| 7.626506
| 0.312584
| 0.091276
| 0.136388
| 0.181148
| 0.140161
| 0.13156
| 0.124539
| 0.100755
| 0.0825
| 0.045814
| 0
| 0.066322
| 0.256984
| 19,258
| 380
| 5,793
| 50.678947
| 0.72989
| 0.033908
| 0
| 0.232258
| 0
| 0.029032
| 0.540542
| 0.441572
| 0
| 1
| 0
| 0
| 0
| 1
| 0.022581
| false
| 0.025806
| 0.022581
| 0.003226
| 0.1
| 0.012903
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
9c3cff844eb75b8bf5bf667457ab698b150ca194
| 371
|
py
|
Python
|
gleipnir/pysb_utilities/__init__.py
|
LoLab-VU/Gleipnir
|
6085435f4840d403c0878b0d50192565ccc82965
|
[
"MIT"
] | 2
|
2019-07-11T14:45:04.000Z
|
2019-07-29T16:21:41.000Z
|
gleipnir/pysb_utilities/__init__.py
|
LoLab-VU/Gleipnir
|
6085435f4840d403c0878b0d50192565ccc82965
|
[
"MIT"
] | 13
|
2019-05-20T03:14:03.000Z
|
2021-01-07T17:23:23.000Z
|
gleipnir/pysb_utilities/__init__.py
|
LoLab-VU/Gleipnir
|
6085435f4840d403c0878b0d50192565ccc82965
|
[
"MIT"
] | 3
|
2019-05-29T04:53:58.000Z
|
2020-09-25T22:15:11.000Z
|
import warnings
import pysb
from pysb.simulator import ScipyOdeSimulator
from .nestedsample_it import NestedSampleIt, NestIt
try:
from .hyp_selector import HypSelector
from .model_selector import ModelSelector
except:
warnings.warn('Unable to load HypSelector and ModelSelector into pysb_utilities. If you want to use these tools please install HypBuilder.')
| 37.1
| 144
| 0.819407
| 48
| 371
| 6.25
| 0.6875
| 0.093333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 371
| 9
| 145
| 41.222222
| 0.943396
| 0
| 0
| 0
| 0
| 0
| 0.331536
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
9c3e81aca28a3203b6afd925720b69d968f2c16f
| 1,891
|
py
|
Python
|
keras/utils/__init__.py
|
maybeLee/keras
|
793620ae1bdda7e37edd485b034e8962fff57f3e
|
[
"Apache-2.0"
] | 1
|
2022-03-21T02:42:58.000Z
|
2022-03-21T02:42:58.000Z
|
keras/utils/__init__.py
|
maybeLee/keras
|
793620ae1bdda7e37edd485b034e8962fff57f3e
|
[
"Apache-2.0"
] | 1
|
2022-03-31T16:40:51.000Z
|
2022-03-31T16:40:51.000Z
|
keras/utils/__init__.py
|
maybeLee/keras
|
793620ae1bdda7e37edd485b034e8962fff57f3e
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Public Keras utilities."""
# pylint: disable=g-bad-import-order
from keras.utils.data_utils import get_file
from keras.utils.generic_utils import Progbar
from keras.utils.image_dataset import image_dataset_from_directory
from keras.utils.text_dataset import text_dataset_from_directory
from keras.utils.tf_utils import set_random_seed
from keras.utils.timeseries_dataset import timeseries_dataset_from_array
from keras.utils.vis_utils import model_to_dot
from keras.utils.vis_utils import plot_model
from keras.utils.np_utils import normalize
from keras.utils.np_utils import to_categorical
# Sequence related
from keras.utils.data_utils import Sequence
from keras.utils.data_utils import GeneratorEnqueuer
from keras.utils.data_utils import OrderedEnqueuer
from keras.utils.data_utils import SequenceEnqueuer
# Serialization related
from keras.utils.generic_utils import custom_object_scope
from keras.utils.generic_utils import CustomObjectScope
from keras.utils.generic_utils import deserialize_keras_object
from keras.utils.generic_utils import get_custom_objects
from keras.utils.generic_utils import serialize_keras_object
# Internal
from keras.utils.layer_utils import get_source_inputs
| 42.022222
| 80
| 0.800106
| 274
| 1,891
| 5.354015
| 0.419708
| 0.122699
| 0.190866
| 0.08589
| 0.351057
| 0.351057
| 0
| 0
| 0
| 0
| 0
| 0.004742
| 0.107879
| 1,891
| 44
| 81
| 42.977273
| 0.864849
| 0.406134
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
9c40aad1beb5580595527f7585d5db697d81b1bf
| 79
|
py
|
Python
|
bluefloodclient/__init__.py
|
absalon-james/python-blueflood
|
1ed83308de96fd8b6e41237ac99d1946b74f2d10
|
[
"Apache-2.0"
] | null | null | null |
bluefloodclient/__init__.py
|
absalon-james/python-blueflood
|
1ed83308de96fd8b6e41237ac99d1946b74f2d10
|
[
"Apache-2.0"
] | null | null | null |
bluefloodclient/__init__.py
|
absalon-james/python-blueflood
|
1ed83308de96fd8b6e41237ac99d1946b74f2d10
|
[
"Apache-2.0"
] | null | null | null |
from client import Blueflood as Client
from utils import time_in_ms, time_in_s
| 26.333333
| 39
| 0.848101
| 15
| 79
| 4.2
| 0.666667
| 0.190476
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139241
| 79
| 2
| 40
| 39.5
| 0.926471
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
9c531f5167a611561c5947d4213dc4579f086b64
| 625
|
py
|
Python
|
pydeep/core.py
|
jytan17/deep_learning_framework
|
c0a55c0d9d201aacfe03e4d49b9f0d1b75278eb5
|
[
"MIT"
] | null | null | null |
pydeep/core.py
|
jytan17/deep_learning_framework
|
c0a55c0d9d201aacfe03e4d49b9f0d1b75278eb5
|
[
"MIT"
] | null | null | null |
pydeep/core.py
|
jytan17/deep_learning_framework
|
c0a55c0d9d201aacfe03e4d49b9f0d1b75278eb5
|
[
"MIT"
] | null | null | null |
import numpy as np
class Variable:
def __init__(self, data):
self.data = data if not isinstance(data, np.ndarray) else np.array(data)
self.grad = None
def zero_grad(self):
self.grad = None
class Function:
def __init__(self, *args, **kwargs):
self.cache = {}
def __call__(self, *args, **kwargs):
output = self.forward(*args, **kwargs)
self.local_grad(*args, **kwargs)
return output
def forward(self, *args, **kwargs):
pass
def backward(self, *args, **kwargs):
pass
def local_grad(self, *args, **kwargs):
pass
| 20.833333
| 80
| 0.584
| 78
| 625
| 4.487179
| 0.384615
| 0.2
| 0.2
| 0.154286
| 0.12
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2864
| 625
| 30
| 81
| 20.833333
| 0.784753
| 0
| 0
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.35
| false
| 0.15
| 0.05
| 0
| 0.55
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
92cf0f66b89334cd2e2c15683bae5b1565642601
| 212
|
py
|
Python
|
project_name/users/views.py
|
rnegron/django-project-template
|
165229b46d1ffebebaeab22f86089e053c995302
|
[
"MIT"
] | 7
|
2020-04-12T20:01:46.000Z
|
2021-08-06T14:25:09.000Z
|
project_name/users/views.py
|
rnegron/django-project-template
|
165229b46d1ffebebaeab22f86089e053c995302
|
[
"MIT"
] | 183
|
2020-04-16T09:14:59.000Z
|
2022-03-30T09:20:42.000Z
|
project_name/users/views.py
|
rnegron/django-project-template
|
165229b46d1ffebebaeab22f86089e053c995302
|
[
"MIT"
] | 1
|
2022-03-11T19:08:43.000Z
|
2022-03-11T19:08:43.000Z
|
from rest_framework import generics
from . import models, serializers
class UserListView(generics.ListCreateAPIView):
queryset = models.User.objects.all()
serializer_class = serializers.UserSerializer
| 23.555556
| 49
| 0.801887
| 22
| 212
| 7.636364
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.132075
| 212
| 8
| 50
| 26.5
| 0.913043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
92cfc0a2ffe508c99fc34d47052c7bf07c66fd38
| 7,903
|
py
|
Python
|
tests/v2/test_menu.py
|
ThaDeveloper/FastFoodFast_API
|
2fc1255b0aef2404547374c0854911c770c51e27
|
[
"MIT"
] | 1
|
2019-02-13T10:51:08.000Z
|
2019-02-13T10:51:08.000Z
|
tests/v2/test_menu.py
|
ThaDeveloper/FastFoodFast_API
|
2fc1255b0aef2404547374c0854911c770c51e27
|
[
"MIT"
] | 10
|
2018-09-24T15:55:22.000Z
|
2018-10-01T08:15:03.000Z
|
tests/v2/test_menu.py
|
ThaDeveloper/FastFoodFast_API
|
2fc1255b0aef2404547374c0854911c770c51e27
|
[
"MIT"
] | 1
|
2018-10-06T15:17:23.000Z
|
2018-10-06T15:17:23.000Z
|
import json
import unittest
from tests.v2.test_setup import TestSetup
class TestMenu(TestSetup):
def test_menu_access_with_invalid_token(self):
"""Raise unauthorized error invalid token."""
response = self.client.post("/api/v2/menu",
data=json.dumps(self.menu_item),
content_type="application/json",
headers={"x-access-token": "Wrong token"})
self.assertEqual(response.status_code, 401)
def test_menu_access_with_mising_token(self):
"""Raise unauthorized error missing token."""
response = self.client.post("/api/v2/menu",
data=json.dumps(self.menu_item),
content_type="application/json")
self.assertEqual(response.status_code, 401)
def test_add_new_menu(self):
"""Tests creating a new menu."""
response = self.client.post('/api/v2/menu',
data=json.dumps(self.menu_item),
content_type="application/json",
headers={"x-access-token": self.admintoken})
print(json.dumps(self.menu))
self.assertEqual(response.status_code, 201)
response_msg = json.loads(response.data.decode("UTF-8"))
self.assertIn("added", response_msg["Message"])
def test_empty_name(self):
"""Error raised for blank menu name.
A menu must have a name."""
response = self.client.post("/api/v2/menu",
data=json.dumps(dict(name="")),
content_type="application/json",
headers={"x-access-token": self.token})
self.assertEqual(response.status_code, 400)
response_msg = json.loads(response.data.decode("UTF-8"))
self.assertIn("empty", response_msg["Message"])
def test_duplicates_prevented(self):
"""
Error raised for duplicate menu names.
"""
self.client.post("/api/v2/menu",
data=json.dumps(self.menu),
content_type="application/json",
headers={"x-access-token": self.token})
response = self.client.post("/api/v2/menu",
data=json.dumps(dict(name="rice",
image="rice.jpg",
price=800,
category="main")),
content_type="application/json",
headers={"x-access-token": self.token})
self.assertEqual(response.status_code, 400)
response_msg = json.loads(response.data.decode("UTF-8"))
self.assertIn("already exists", response_msg["Message"])
def test_menu_list(self):
resp = self.client.get('/api/v2/menu')
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.content_type, 'application/json')
def test_menu_detail_200(self):
"""Test if you can get a single menu.
Register a single menu first"""
resp = self.client.get(
'/api/v2/menu/2')
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.content_type, 'application/json')
def test_invalid_menu_request(self):
"""
Error raised for invalid menu request.
"""
resp = self.client.get("/api/v2/menu/1000")
self.assertEqual(resp.status_code, 404)
response_msg = json.loads(resp.data.decode("UTF-8"))
self.assertIn("not found", response_msg["Message"])
def test_update_menu(self):
"""Tests a menu can be updated."""
response = self.client.put(
"/api/v2/menu/2",
data=json.dumps(
self.new_menu_item),
content_type="application/json",
headers={
"x-access-token": self.admintoken})
self.assertEqual(response.status_code, 200)
response_msg = json.loads(response.data.decode("UTF-8"))
self.assertIn("updated", response_msg["Message"])
def test_invalid_update(self):
"""Error raised for invalid update request."""
response = self.client.put("/api/v2/menu/1000",
data=json.dumps(self.new_menu_item),
content_type="application/json",
headers={"x-access-token": self.admintoken})
self.assertEqual(response.status_code, 404)
response_msg = json.loads(response.data.decode("UTF-8"))
self.assertIn("not found", response_msg["Message"])
def test_updating_unauthorized_menu(self):
"""Tests error raised when normal user try update menu."""
response = self.client.put(
"/api/v2/menu/2",
data=json.dumps(
self.new_menu_item),
content_type="application/json",
headers={
"x-access-token": self.token})
self.assertEqual(response.status_code, 401)
response_msg = json.loads(response.data.decode("UTF-8"))
self.assertIn("Not authorized", response_msg["Message"])
def test_duplicate_updates(self):
"""
Tests for updating menu to a name that already exists.
"""
response = self.client.put("/api/v2/menu/2",
data=json.dumps(self.menu_item),
content_type="application/json",
headers={
"x-access-token": self.admintoken})
self.assertEqual(response.status_code, 400)
response_msg = json.loads(response.data.decode("UTF-8"))
self.assertIn("already exists", response_msg["Message"])
def test_delete_menu(self):
"""Tests menu deletion."""
response = self.client.delete(
"/api/v2/menu/1",
content_type="application/json",
headers={
"x-access-token": self.admintoken})
self.assertEqual(response.status_code, 200)
response_msg = json.loads(response.data.decode("UTF-8"))
self.assertIn("deleted", response_msg["Message"])
def test_deleting_unauthorized_menu(self):
"""Tests error raised when deleting if not admin."""
response = self.client.delete(
"/api/v2/menu/3",
content_type="application/json",
headers={
"x-access-token": self.unkowntoken})
self.assertEqual(response.status_code, 401)
response_msg = json.loads(response.data.decode("UTF-8"))
self.assertIn("Not authorized", response_msg["Message"])
def test_invalid_delete(self):
"""Error raised for invalid delete request."""
response = self.client.delete("/api/v2/menu/1000",
content_type="application/json",
headers={"x-access-token": self.admintoken})
self.assertEqual(response.status_code, 404)
response_msg = json.loads(response.data.decode("UTF-8"))
self.assertIn("not found", response_msg["Message"])
def test_delete_with_invalid_token(self):
"""Test return invalid if token is invalid"""
response = self.client.delete(
"/api/v2/menu/1",
content_type="application/json",
headers={
"x-access-token": "dd"})
self.assertEqual(response.status_code, 401)
response_msg = json.loads(response.data.decode("UTF-8"))
self.assertIn("Invalid", response_msg["Message"])
if __name__ == "__main__":
unittest.main()
| 43.423077
| 82
| 0.5546
| 850
| 7,903
| 5.015294
| 0.138824
| 0.061928
| 0.03589
| 0.097584
| 0.811166
| 0.741027
| 0.729064
| 0.660568
| 0.640394
| 0.6289
| 0
| 0.019206
| 0.321397
| 7,903
| 181
| 83
| 43.662983
| 0.775685
| 0.080602
| 0
| 0.610294
| 0
| 0
| 0.135655
| 0
| 0
| 0
| 0
| 0
| 0.220588
| 1
| 0.117647
| false
| 0
| 0.022059
| 0
| 0.147059
| 0.007353
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
13152aef9c34c1b811c5d3b41e1d6297ac5cbfd9
| 124
|
py
|
Python
|
code/abc142_b_03.py
|
KoyanagiHitoshi/AtCoder
|
731892543769b5df15254e1f32b756190378d292
|
[
"MIT"
] | 3
|
2019-08-16T16:55:48.000Z
|
2021-04-11T10:21:40.000Z
|
code/abc142_b_03.py
|
KoyanagiHitoshi/AtCoder
|
731892543769b5df15254e1f32b756190378d292
|
[
"MIT"
] | null | null | null |
code/abc142_b_03.py
|
KoyanagiHitoshi/AtCoder
|
731892543769b5df15254e1f32b756190378d292
|
[
"MIT"
] | null | null | null |
N,K=map(int,input().split())
H=list(map(int,input().split()))
count=0
for h in H:
if h>=K:
count+=1
print(count)
| 17.714286
| 32
| 0.580645
| 25
| 124
| 2.88
| 0.6
| 0.166667
| 0.305556
| 0.444444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.019608
| 0.177419
| 124
| 7
| 33
| 17.714286
| 0.686275
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.142857
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
1325555b77423b4b4b5782f1cf9a877a04bbb0c8
| 60
|
py
|
Python
|
src/paths.py
|
networkdynamics/PuckIt
|
08542c324440919960198eae4ca8855f2ac43134
|
[
"Apache-2.0"
] | 1
|
2018-05-16T20:58:32.000Z
|
2018-05-16T20:58:32.000Z
|
src/paths.py
|
networkdynamics/PuckIt
|
08542c324440919960198eae4ca8855f2ac43134
|
[
"Apache-2.0"
] | null | null | null |
src/paths.py
|
networkdynamics/PuckIt
|
08542c324440919960198eae4ca8855f2ac43134
|
[
"Apache-2.0"
] | null | null | null |
data_dir = '/home/ndg/projects/shared_datasets/PuckIt/data'
| 30
| 59
| 0.8
| 9
| 60
| 5.111111
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.05
| 60
| 1
| 60
| 60
| 0.807018
| 0
| 0
| 0
| 0
| 0
| 0.766667
| 0.766667
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
133244f915bf9a4d025995ad4b90df11ced77a9e
| 626
|
py
|
Python
|
radynpy/cdf/auxtypes/AuxTypes.py
|
Goobley/radynpy
|
acf685f6ad17be63065fc468e40293b6cf063081
|
[
"MIT"
] | 7
|
2019-01-27T20:41:38.000Z
|
2020-02-18T16:27:26.000Z
|
radynpy/cdf/auxtypes/AuxTypes.py
|
grahamkerr/radynpy
|
63e06c63476b4cc74568da443f71c12412b83bac
|
[
"MIT"
] | 3
|
2020-02-25T18:51:20.000Z
|
2020-03-19T13:02:14.000Z
|
radynpy/cdf/auxtypes/AuxTypes.py
|
grahamkerr/radynpy
|
63e06c63476b4cc74568da443f71c12412b83bac
|
[
"MIT"
] | 1
|
2020-02-18T00:20:16.000Z
|
2020-02-18T00:20:16.000Z
|
class Val:
def __init__(self, val):
self.val = val
def __repr__(self):
return 'Val(%s)' % self.val.__repr__()
class Array:
def __init__(self, shape):
self.shape = shape
def __repr__(self):
return 'Array%s' % self.shape.__repr__()
def idl_repr(self):
s = '['
for i, idx in enumerate(self.shape):
assert(type(idx) == str)
s += idx
if i != len(self.shape)-1:
s +=','
s += ']'
return s
class Unknown:
def __init__(self):
pass
def __repr__(self):
return 'Unknown'
| 19.5625
| 48
| 0.496805
| 75
| 626
| 3.706667
| 0.32
| 0.161871
| 0.118705
| 0.183453
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.002532
| 0.36901
| 626
| 31
| 49
| 20.193548
| 0.701266
| 0
| 0
| 0.125
| 0
| 0
| 0.0384
| 0
| 0
| 0
| 0
| 0
| 0.041667
| 1
| 0.291667
| false
| 0.041667
| 0
| 0.125
| 0.583333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
133cb7f6b246d652f37851f2c0a43bf90a24afd2
| 125
|
py
|
Python
|
blog/admin.py
|
jberends/django_neo_3.3.0
|
b6a4f5460f82fd019c2ea4e043a57d59104a3e52
|
[
"Unlicense"
] | null | null | null |
blog/admin.py
|
jberends/django_neo_3.3.0
|
b6a4f5460f82fd019c2ea4e043a57d59104a3e52
|
[
"Unlicense"
] | null | null | null |
blog/admin.py
|
jberends/django_neo_3.3.0
|
b6a4f5460f82fd019c2ea4e043a57d59104a3e52
|
[
"Unlicense"
] | null | null | null |
from django.contrib import admin
# Register your models here.
from blog.models import Article
admin.site.register(Article)
| 17.857143
| 32
| 0.808
| 18
| 125
| 5.611111
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.128
| 125
| 6
| 33
| 20.833333
| 0.926606
| 0.208
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
1357e98307405edd28570fb5a73d7d9b770f9e8b
| 619
|
py
|
Python
|
buildconfig/runpersistent/__init__.py
|
kcemenike/buildconfig
|
1090f54bf4def722e0aecbd3c273ae0064163008
|
[
"MIT"
] | null | null | null |
buildconfig/runpersistent/__init__.py
|
kcemenike/buildconfig
|
1090f54bf4def722e0aecbd3c273ae0064163008
|
[
"MIT"
] | null | null | null |
buildconfig/runpersistent/__init__.py
|
kcemenike/buildconfig
|
1090f54bf4def722e0aecbd3c273ae0064163008
|
[
"MIT"
] | 1
|
2021-01-22T17:44:14.000Z
|
2021-01-22T17:44:14.000Z
|
from __future__ import print_function
import sys
import os
if sys.platform == 'darwin':
from . import runpersistent_helpercmd
runpersistent_helpercmd.sessioncmd = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'background-process-darwin.sh')
from .runpersistent_helpercmd import *
elif sys.platform == 'linux':
from . import runpersistent_helpercmd
runpersistent_helpercmd.sessioncmd = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'background-process-screen.sh')
from .runpersistent_helpercmd import *
else:
raise NotImplementedError('no support for this platform')
| 36.411765
| 129
| 0.772213
| 75
| 619
| 6.12
| 0.413333
| 0.287582
| 0.100218
| 0.139434
| 0.675381
| 0.527233
| 0.527233
| 0.527233
| 0.527233
| 0.527233
| 0
| 0
| 0.12601
| 619
| 16
| 130
| 38.6875
| 0.848429
| 0
| 0
| 0.307692
| 0
| 0
| 0.153722
| 0.090615
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.538462
| 0
| 0.538462
| 0.076923
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
136f1dede9b93c422fa63c7b94012c542cacc1d5
| 481
|
py
|
Python
|
tests/constraints/test_required.py
|
vincentchevrier/tableschema-py
|
d47b6d73ab3ea1051c866b93b6e2b9202bbd40b1
|
[
"MIT"
] | 224
|
2017-04-11T11:29:48.000Z
|
2022-03-26T18:34:50.000Z
|
tests/constraints/test_required.py
|
vincentchevrier/tableschema-py
|
d47b6d73ab3ea1051c866b93b6e2b9202bbd40b1
|
[
"MIT"
] | 111
|
2017-03-28T19:02:01.000Z
|
2021-12-20T08:42:21.000Z
|
tests/constraints/test_required.py
|
vincentchevrier/tableschema-py
|
d47b6d73ab3ea1051c866b93b6e2b9202bbd40b1
|
[
"MIT"
] | 40
|
2017-04-01T08:21:57.000Z
|
2021-02-28T23:52:07.000Z
|
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from tableschema import constraints
# Tests
@pytest.mark.parametrize('constraint, value, result', [
(False, 1, True),
(True, 0, True),
(True, None, False),
])
def test_check_required(constraint, value, result):
assert constraints.check_required(constraint, value) == result
| 24.05
| 66
| 0.75052
| 58
| 481
| 5.844828
| 0.534483
| 0.117994
| 0.188791
| 0.165192
| 0.20059
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007335
| 0.149688
| 481
| 19
| 67
| 25.315789
| 0.821516
| 0.056133
| 0
| 0
| 0
| 0
| 0.055432
| 0
| 0
| 0
| 0
| 0
| 0.076923
| 1
| 0.076923
| false
| 0
| 0.461538
| 0
| 0.538462
| 0.076923
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
1378433f0371f8ad12f55a1261517f5515690250
| 81
|
py
|
Python
|
psiturk/__main__.py
|
CatherineWong/psiTurk
|
ddd7b44b87a42a3e5eb16067e1a8a8a408a29353
|
[
"MIT"
] | 6
|
2015-02-13T12:46:07.000Z
|
2020-02-20T08:56:15.000Z
|
psiturk/__main__.py
|
CatherineWong/psiTurk
|
ddd7b44b87a42a3e5eb16067e1a8a8a408a29353
|
[
"MIT"
] | null | null | null |
psiturk/__main__.py
|
CatherineWong/psiTurk
|
ddd7b44b87a42a3e5eb16067e1a8a8a408a29353
|
[
"MIT"
] | 1
|
2020-10-09T12:57:24.000Z
|
2020-10-09T12:57:24.000Z
|
if __name__ == '__main__':
import experiment
experiment.run_webserver()
| 16.2
| 30
| 0.703704
| 8
| 81
| 6
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.197531
| 81
| 4
| 31
| 20.25
| 0.738462
| 0
| 0
| 0
| 0
| 0
| 0.1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
1382121718cea8b0928efecb50f43cee2c38939c
| 335
|
py
|
Python
|
tukey/status/templatetags/status_tags.py
|
Li-Ko/tukey_portal
|
8dc395ef1a1ebaa806d23c88ce51460e6c202921
|
[
"Apache-2.0"
] | null | null | null |
tukey/status/templatetags/status_tags.py
|
Li-Ko/tukey_portal
|
8dc395ef1a1ebaa806d23c88ce51460e6c202921
|
[
"Apache-2.0"
] | null | null | null |
tukey/status/templatetags/status_tags.py
|
Li-Ko/tukey_portal
|
8dc395ef1a1ebaa806d23c88ce51460e6c202921
|
[
"Apache-2.0"
] | null | null | null |
from django import template
register = template.Library()
@register.filter(name='getkey')
def getkey(value, arg):
return value[arg]
@register.filter(name='multiply')
def multiply(value, arg):
return float(value) * float(arg)
@register.filter(name='startswith')
def startswith(value, arg):
return value.startswith(arg)
| 20.9375
| 37
| 0.728358
| 43
| 335
| 5.674419
| 0.372093
| 0.131148
| 0.221311
| 0.155738
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.131343
| 335
| 15
| 38
| 22.333333
| 0.838488
| 0
| 0
| 0
| 0
| 0
| 0.071642
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.272727
| false
| 0
| 0.090909
| 0.272727
| 0.636364
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
138b3056f96a6b2a1dfb7f56f80cc797f57598f5
| 4,799
|
py
|
Python
|
pyeccodes/defs/grib2/tables/6/4_202_table.py
|
ecmwf/pyeccodes
|
dce2c72d3adcc0cb801731366be53327ce13a00b
|
[
"Apache-2.0"
] | 7
|
2020-04-14T09:41:17.000Z
|
2021-08-06T09:38:19.000Z
|
pyeccodes/defs/grib2/tables/local/edzw/1/4_7_table.py
|
ecmwf/pyeccodes
|
dce2c72d3adcc0cb801731366be53327ce13a00b
|
[
"Apache-2.0"
] | null | null | null |
pyeccodes/defs/grib2/tables/local/edzw/1/4_7_table.py
|
ecmwf/pyeccodes
|
dce2c72d3adcc0cb801731366be53327ce13a00b
|
[
"Apache-2.0"
] | 3
|
2020-04-30T12:44:48.000Z
|
2020-12-15T08:40:26.000Z
|
def load(h):
return ({'abbr': 192, 'code': 192, 'title': 'Reserved for local use'},
{'abbr': 193, 'code': 193, 'title': 'Reserved for local use'},
{'abbr': 194, 'code': 194, 'title': 'Reserved for local use'},
{'abbr': 195, 'code': 195, 'title': 'Reserved for local use'},
{'abbr': 196, 'code': 196, 'title': 'Reserved for local use'},
{'abbr': 197, 'code': 197, 'title': 'Reserved for local use'},
{'abbr': 198, 'code': 198, 'title': 'Reserved for local use'},
{'abbr': 199, 'code': 199, 'title': 'Reserved for local use'},
{'abbr': 200, 'code': 200, 'title': 'Reserved for local use'},
{'abbr': 201, 'code': 201, 'title': 'Reserved for local use'},
{'abbr': 202, 'code': 202, 'title': 'Reserved for local use'},
{'abbr': 203, 'code': 203, 'title': 'Reserved for local use'},
{'abbr': 204, 'code': 204, 'title': 'Reserved for local use'},
{'abbr': 205, 'code': 205, 'title': 'Reserved for local use'},
{'abbr': 206, 'code': 206, 'title': 'Reserved for local use'},
{'abbr': 207, 'code': 207, 'title': 'Reserved for local use'},
{'abbr': 208, 'code': 208, 'title': 'Reserved for local use'},
{'abbr': 209, 'code': 209, 'title': 'Reserved for local use'},
{'abbr': 210, 'code': 210, 'title': 'Reserved for local use'},
{'abbr': 211, 'code': 211, 'title': 'Reserved for local use'},
{'abbr': 212, 'code': 212, 'title': 'Reserved for local use'},
{'abbr': 213, 'code': 213, 'title': 'Reserved for local use'},
{'abbr': 214, 'code': 214, 'title': 'Reserved for local use'},
{'abbr': 215, 'code': 215, 'title': 'Reserved for local use'},
{'abbr': 216, 'code': 216, 'title': 'Reserved for local use'},
{'abbr': 217, 'code': 217, 'title': 'Reserved for local use'},
{'abbr': 218, 'code': 218, 'title': 'Reserved for local use'},
{'abbr': 219, 'code': 219, 'title': 'Reserved for local use'},
{'abbr': 220, 'code': 220, 'title': 'Reserved for local use'},
{'abbr': 221, 'code': 221, 'title': 'Reserved for local use'},
{'abbr': 222, 'code': 222, 'title': 'Reserved for local use'},
{'abbr': 223, 'code': 223, 'title': 'Reserved for local use'},
{'abbr': 224, 'code': 224, 'title': 'Reserved for local use'},
{'abbr': 225, 'code': 225, 'title': 'Reserved for local use'},
{'abbr': 226, 'code': 226, 'title': 'Reserved for local use'},
{'abbr': 227, 'code': 227, 'title': 'Reserved for local use'},
{'abbr': 228, 'code': 228, 'title': 'Reserved for local use'},
{'abbr': 229, 'code': 229, 'title': 'Reserved for local use'},
{'abbr': 230, 'code': 230, 'title': 'Reserved for local use'},
{'abbr': 231, 'code': 231, 'title': 'Reserved for local use'},
{'abbr': 232, 'code': 232, 'title': 'Reserved for local use'},
{'abbr': 233, 'code': 233, 'title': 'Reserved for local use'},
{'abbr': 234, 'code': 234, 'title': 'Reserved for local use'},
{'abbr': 235, 'code': 235, 'title': 'Reserved for local use'},
{'abbr': 236, 'code': 236, 'title': 'Reserved for local use'},
{'abbr': 237, 'code': 237, 'title': 'Reserved for local use'},
{'abbr': 238, 'code': 238, 'title': 'Reserved for local use'},
{'abbr': 239, 'code': 239, 'title': 'Reserved for local use'},
{'abbr': 240, 'code': 240, 'title': 'Reserved for local use'},
{'abbr': 241, 'code': 241, 'title': 'Reserved for local use'},
{'abbr': 242, 'code': 242, 'title': 'Reserved for local use'},
{'abbr': 243, 'code': 243, 'title': 'Reserved for local use'},
{'abbr': 244, 'code': 244, 'title': 'Reserved for local use'},
{'abbr': 245, 'code': 245, 'title': 'Reserved for local use'},
{'abbr': 246, 'code': 246, 'title': 'Reserved for local use'},
{'abbr': 247, 'code': 247, 'title': 'Reserved for local use'},
{'abbr': 248, 'code': 248, 'title': 'Reserved for local use'},
{'abbr': 249, 'code': 249, 'title': 'Reserved for local use'},
{'abbr': 250, 'code': 250, 'title': 'Reserved for local use'},
{'abbr': 251, 'code': 251, 'title': 'Reserved for local use'},
{'abbr': 252, 'code': 252, 'title': 'Reserved for local use'},
{'abbr': 253, 'code': 253, 'title': 'Reserved for local use'},
{'abbr': 254, 'code': 254, 'title': 'Reserved for local use'},
{'abbr': None, 'code': 255, 'title': 'Missing'})
| 72.712121
| 74
| 0.507397
| 577
| 4,799
| 4.220104
| 0.133449
| 0.336345
| 0.413963
| 0.543326
| 0.724435
| 0.724435
| 0
| 0
| 0
| 0
| 0
| 0.11002
| 0.278391
| 4,799
| 65
| 75
| 73.830769
| 0.593127
| 0
| 0
| 0
| 0
| 0
| 0.463638
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.015385
| false
| 0
| 0
| 0.015385
| 0.030769
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
138d4b0faf949a63aaf989b36932828fb9d64b49
| 6,898
|
py
|
Python
|
bif_with_color/beta=0.1/compare.py
|
helene-todd/M2_thesis_code
|
f844d6652229c6abe09bd40aa43f5002faa9e5ba
|
[
"MIT"
] | null | null | null |
bif_with_color/beta=0.1/compare.py
|
helene-todd/M2_thesis_code
|
f844d6652229c6abe09bd40aa43f5002faa9e5ba
|
[
"MIT"
] | null | null | null |
bif_with_color/beta=0.1/compare.py
|
helene-todd/M2_thesis_code
|
f844d6652229c6abe09bd40aa43f5002faa9e5ba
|
[
"MIT"
] | null | null | null |
from matplotlib import cm, rcParams
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib as matplotlib
import numpy as np
import math as math
import random as rand
import os, sys
import csv
import argparse
#plt.rcParams['axes.xmargin'] = 0
#plt.rcParams['axes.facecolor'] = 'black'
c = ['#aa3863', '#3b7d86']
s = ['-', '--']
fig, ax = plt.subplots(1, 2, figsize=(15,6), sharey='row')
min_val, max_val = 10**0, 10**3
def truncate_colormap(cmap, minval=0.0, maxval=1.0, n=100):
new_cmap = colors.LinearSegmentedColormap.from_list(
'trunc({n},{a:.2f},{b:.2f})'.format(n=cmap.name, a=minval, b=maxval),
cmap(np.linspace(minval, maxval, n)))
return new_cmap
def row_count(filename):
with open(filename) as in_file:
return sum(1 for _ in in_file)
""" gamma = 0.2 """
I = [[]]
phi = [[]]
stability = []
for filename in ['gamma = 0.2/gamma_0.2.dat', 'gamma = 0.2/stable1.dat', 'gamma = 0.2/stable2.dat'] :
with open(filename, newline='') as file:
datareader = csv.reader(file, delimiter=' ')
last_line_nb = row_count(filename)
last_I = -999
last_phi = -999
last_stability = 0
# seperate into sublists by checking if two consecutive values are duplicates
for row in datareader:
# the 2nd condition avoids a list with one value when two consecutive values are duplicates
if last_I == float(row[0]) and len(I[-1]) > 1 :
if last_stability != int(row[3]):
I[-1].append(last_I)
phi[-1].append(last_phi)
I.append([])
phi.append([])
if last_stability != 0 :
stability.append(last_stability)
if last_I != -999 :
I[-1].append(last_I)
phi[-1].append(last_phi)
if last_stability != int(row[3]) and len(I[-1]) > 1:
I.append([])
phi.append([])
if last_stability != 0 :
stability.append(last_stability)
# if at last line, then stop checking for consecutive values and just add the remaining data
if last_line_nb == datareader.line_num:
I[-1].append(float(row[0]))
phi[-1].append(float(row[1]))
stability.append(int(row[3]))
last_I = float(row[0])
last_phi = float(row[1])
last_stability = int(row[3])
Imin, Imax = 2, 0
for l in range(len(I)) :
for k in range(len(I[l])) :
if phi[l][k] not in [0, 1, 0.5] and I[l][k] > Imax :
Imax = I[l][k]
if phi[l][k] == 0.5 and stability[l] == 1 and I[l][k] < Imin :
Imin = I[l][k]
data = np.load('gamma = 0.2/mesh_cycles.npz')
for k in range(len(I)) :
if stability[k] == 1 :
ax[0].plot(I[k], phi[k], color='black', linewidth=2, linestyle=s[stability[k]-1], label='stable')
if stability[k] == 2 :
ax[0].plot(I[k], phi[k], color='black', linewidth=2, linestyle=s[stability[k]-1], label='unstable')
# regime delimiter to make things more visual
ax[0].set_ylim(-0.05, 1.05)
ax[0].set_xlim(1, 2)
ax[0].set_title('$\gamma$=0.2', fontsize=14)
ax[0].set_xlabel('Current $I$', size=12)
ax[0].set_ylabel('Phase Difference $\phi$', size=12)
# remove duplicate legend
handles, labels = plt.gca().get_legend_handles_labels()
by_label = dict(zip(labels, handles))
ax[0].pcolormesh(data['I'], data['phi'], data['cycles'], cmap='viridis', shading='smooth', edgecolors=None, norm = colors.SymLogNorm(linthresh=0.03, linscale=0.03, vmin=min_val, vmax=max_val, base=10))
""" gamma = 0.4 """
I = [[]]
phi = [[]]
stability = []
for filename in ['gamma = 0.4/gamma_0.4.dat', 'gamma = 0.4/stable1.dat', 'gamma = 0.4/stable2.dat']:
with open(filename, newline='') as file:
datareader = csv.reader(file, delimiter=' ')
last_line_nb = row_count(filename)
last_I = -999
last_phi = -999
last_stability = 0
# seperate into sublists by checking if two consecutive values are duplicates
for row in datareader:
# the 2nd condition avoids a list with one value when two consecutive values are duplicates
if last_I == float(row[0]) and len(I[-1]) > 1 :
if last_stability != int(row[3]):
I[-1].append(last_I)
phi[-1].append(last_phi)
I.append([])
phi.append([])
if last_stability != 0 :
stability.append(last_stability)
if last_I != -999 :
I[-1].append(last_I)
phi[-1].append(last_phi)
if last_stability != int(row[3]) and len(I[-1]) > 1:
I.append([])
phi.append([])
if last_stability != 0 :
stability.append(last_stability)
# if at last line, then stop checking for consecutive values and just add the remaining data
if last_line_nb == datareader.line_num:
I[-1].append(float(row[0]))
phi[-1].append(float(row[1]))
stability.append(int(row[3]))
last_I = float(row[0])
last_phi = float(row[1])
last_stability = int(row[3])
Imin, Imax = 2, 0
for l in range(len(I)) :
for k in range(len(I[l])) :
if phi[l][k] not in [0, 1, 0.5] and I[l][k] > Imax :
Imax = I[l][k]
if phi[l][k] == 0.5 and stability[l] == 1 and I[l][k] < Imin :
Imin = I[l][k]
data = np.load('gamma = 0.4/mesh_cycles.npz')
for k in range(len(I)) :
if stability[k] == 1 :
ax[1].plot(I[k], phi[k], color='black', linewidth=2, linestyle=s[stability[k]-1], label='stable')
if stability[k] == 2 :
ax[1].plot(I[k], phi[k], color='black', linewidth=2, linestyle=s[stability[k]-1], label='unstable')
# regime delimiter to make things more visual
ax[1].set_ylim(-0.05, 1.05)
ax[1].set_xlim(1, 2)
ax[1].set_title('$\gamma$=0.4', fontsize=14)
ax[1].set_xlabel('Current $I$', size=12)
# remove duplicate legend
handles, labels = plt.gca().get_legend_handles_labels()
by_label = dict(zip(labels, handles))
ax[1].legend(by_label.values(), by_label.keys(), loc='upper right', bbox_to_anchor=(1, 0.95))
plt.suptitle('Bifurcation diagram for two coupled neurons, $\\beta$=0.1', size=16)
im = ax[1].pcolormesh(data['I'], data['phi'], data['cycles'], cmap='viridis', shading='smooth', edgecolors=None, norm = colors.SymLogNorm(linthresh=0.03, linscale=0.03, vmin=min_val, vmax=max_val, base=10))
fig.tight_layout()
right = 1.06
fig.subplots_adjust(right=right)
cbar = fig.colorbar(im, ax=ax[:])
cbar.set_label('Number of cycles to converge towards synchrony', labelpad=20, fontsize=12)
plt.savefig('bifs_with_cv_speed.png', dpi=600)
plt.show()
| 34.318408
| 206
| 0.580168
| 1,040
| 6,898
| 3.758654
| 0.204808
| 0.053211
| 0.030698
| 0.029163
| 0.734203
| 0.728575
| 0.718342
| 0.710668
| 0.694295
| 0.694295
| 0
| 0.04541
| 0.259351
| 6,898
| 200
| 207
| 34.49
| 0.71971
| 0.104668
| 0
| 0.642857
| 0
| 0
| 0.088639
| 0.007835
| 0
| 0
| 0
| 0
| 0
| 1
| 0.014286
| false
| 0
| 0.071429
| 0
| 0.1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
13d085848dc8009f1f452a871e7570d9ae0697c9
| 4,122
|
py
|
Python
|
python/phonenumbers/data/region_ZW.py
|
chronossc/python-phonenumbers
|
2ea483bfa9ac19144183dadaa7cafb2772a72bfe
|
[
"Apache-2.0"
] | 1
|
2016-11-20T00:50:06.000Z
|
2016-11-20T00:50:06.000Z
|
python/phonenumbers/data/region_ZW.py
|
chronossc/python-phonenumbers
|
2ea483bfa9ac19144183dadaa7cafb2772a72bfe
|
[
"Apache-2.0"
] | null | null | null |
python/phonenumbers/data/region_ZW.py
|
chronossc/python-phonenumbers
|
2ea483bfa9ac19144183dadaa7cafb2772a72bfe
|
[
"Apache-2.0"
] | null | null | null |
"""Auto-generated file, do not edit by hand. ZW metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_ZW = PhoneMetadata(id='ZW', country_code=263, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='2(?:[012457-9]\\d{3,8}|6\\d{3,6})|[13-79]\\d{4,8}|8[06]\\d{8}', possible_number_pattern='\\d{3,10}'),
fixed_line=PhoneNumberDesc(national_number_pattern='(?:1[3-9]|2(?:0[45]|[16]|2[28]|[49]8?|58[23]|7[246]|8[1346-9])|3(?:08?|17?|3[78]|[2456]|7[1569]|8[379])|5(?:[07-9]|1[78]|483|5(?:7?|8))|6(?:0|28|37?|[45][68][78]|98?)|848)\\d{3,6}|(?:2(?:27|5|7[135789]|8[25])|3[39]|5[1-46]|6[126-8])\\d{4,6}|2(?:(?:0|70)\\d{5,6}|2[05]\\d{7})|(?:4\\d|9[2-8])\\d{4,7}', possible_number_pattern='\\d{3,10}', example_number='1312345'),
mobile=PhoneNumberDesc(national_number_pattern='7[1378]\\d{7}|86(?:22|44)\\d{6}', possible_number_pattern='\\d{9,10}', example_number='711234567'),
toll_free=PhoneNumberDesc(national_number_pattern='800\\d{7}', possible_number_pattern='\\d{10}', example_number='8001234567'),
premium_rate=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
shared_cost=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
personal_number=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
voip=PhoneNumberDesc(national_number_pattern='86(?:1[12]|30|55|77|8[367]|99)\\d{6}', possible_number_pattern='\\d{10}', example_number='8686123456'),
pager=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
uan=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
emergency=PhoneNumberDesc(national_number_pattern='(?:112|99[3459])', possible_number_pattern='\\d{3}', example_number='999'),
voicemail=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
no_international_dialling=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
national_prefix='0',
national_prefix_for_parsing='0',
number_format=[NumberFormat(pattern='([49])(\\d{3})(\\d{2,5})', format=u'\\1 \\2 \\3', leading_digits_pattern=['4|9[2-9]'], national_prefix_formatting_rule=u'0\\1'),
NumberFormat(pattern='([179]\\d)(\\d{3})(\\d{3,4})', format=u'\\1 \\2 \\3', leading_digits_pattern=['[19]1|7'], national_prefix_formatting_rule=u'0\\1'),
NumberFormat(pattern='(86\\d{2})(\\d{3})(\\d{3})', format=u'\\1 \\2 \\3', leading_digits_pattern=['86[24]'], national_prefix_formatting_rule=u'0\\1'),
NumberFormat(pattern='([2356]\\d{2})(\\d{3,5})', format=u'\\1 \\2', leading_digits_pattern=['2(?:[278]|0[45]|[49]8)|3(?:08|17|3[78]|[78])|5[15][78]|6(?:[29]8|37|[68][78])'], national_prefix_formatting_rule=u'0\\1'),
NumberFormat(pattern='(\\d{3})(\\d{3})(\\d{3,4})', format=u'\\1 \\2 \\3', leading_digits_pattern=['2(?:[278]|0[45]|48)|3(?:08|17|3[78]|[78])|5[15][78]|6(?:[29]8|37|[68][78])|80'], national_prefix_formatting_rule=u'0\\1'),
NumberFormat(pattern='([1-356]\\d)(\\d{3,5})', format=u'\\1 \\2', leading_digits_pattern=['1[3-9]|2(?:[1-469]|0[0-35-9]|[45][0-79])|3(?:0[0-79]|1[0-689]|[24-69]|3[0-69])|5(?:[02-46-9]|[15][0-69])|6(?:[0145]|[29][0-79]|3[0-689]|[68][0-69])'], national_prefix_formatting_rule=u'0\\1'),
NumberFormat(pattern='([1-356]\\d)(\\d{3})(\\d{3})', format=u'\\1 \\2 \\3', leading_digits_pattern=['1[3-9]|2(?:[1-469]|0[0-35-9]|[45][0-79])|3(?:0[0-79]|1[0-689]|[24-69]|3[0-69])|5(?:[02-46-9]|[15][0-69])|6(?:[0145]|[29][0-79]|3[0-689]|[68][0-69])'], national_prefix_formatting_rule=u'0\\1'),
NumberFormat(pattern='([25]\\d{3})(\\d{3,5})', format=u'\\1 \\2', leading_digits_pattern=['(?:25|54)8', '258[23]|5483'], national_prefix_formatting_rule=u'0\\1'),
NumberFormat(pattern='([25]\\d{3})(\\d{3})(\\d{3})', format=u'\\1 \\2 \\3', leading_digits_pattern=['(?:25|54)8', '258[23]|5483'], national_prefix_formatting_rule=u'0\\1'),
NumberFormat(pattern='(8\\d{3})(\\d{6})', format=u'\\1 \\2', leading_digits_pattern=['86'], national_prefix_formatting_rule=u'0\\1')])
| 137.4
| 420
| 0.652596
| 704
| 4,122
| 3.644886
| 0.194602
| 0.131723
| 0.081839
| 0.182385
| 0.653546
| 0.63562
| 0.605222
| 0.547545
| 0.535853
| 0.291504
| 0
| 0.154362
| 0.060165
| 4,122
| 29
| 421
| 142.137931
| 0.508002
| 0.012858
| 0
| 0
| 1
| 0.259259
| 0.360571
| 0.271228
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.037037
| 0
| 0.037037
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b9166b600245cfa8c67be03e7507a81719fb2f5a
| 391
|
py
|
Python
|
zenbot/models/serializable.py
|
Dmunch04/ZenBot
|
5002c20eec70b297cfe8bcce5639e67dbf15fa70
|
[
"MIT"
] | 7
|
2019-06-16T15:54:36.000Z
|
2022-03-28T08:53:49.000Z
|
zenbot/models/serializable.py
|
Dmunch04/ZenBot
|
5002c20eec70b297cfe8bcce5639e67dbf15fa70
|
[
"MIT"
] | null | null | null |
zenbot/models/serializable.py
|
Dmunch04/ZenBot
|
5002c20eec70b297cfe8bcce5639e67dbf15fa70
|
[
"MIT"
] | 1
|
2019-06-14T21:42:47.000Z
|
2019-06-14T21:42:47.000Z
|
from typing import Dict, Any
class DBObject(object):
@staticmethod
def new(*args):
raise NotImplementedError
@classmethod
def to_dict(cls) -> Dict[str, Any]:
raise NotImplementedError
# TODO: find a better solution for this method signature i guess
@staticmethod
def from_dict(data: Dict[str, Any], *, args):
raise NotImplementedError
| 23
| 68
| 0.672634
| 46
| 391
| 5.673913
| 0.652174
| 0.275862
| 0.214559
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.248082
| 391
| 16
| 69
| 24.4375
| 0.887755
| 0.158568
| 0
| 0.454545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0625
| 0
| 1
| 0.272727
| false
| 0
| 0.090909
| 0
| 0.454545
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b91ff119509115b912470c777039ac1d83e3ff9f
| 211
|
py
|
Python
|
test/test_dicti.py
|
rudolfbyker/pydicti
|
fa414fd7f8ba3103f40452b2740144f6f50fee69
|
[
"WTFPL"
] | null | null | null |
test/test_dicti.py
|
rudolfbyker/pydicti
|
fa414fd7f8ba3103f40452b2740144f6f50fee69
|
[
"WTFPL"
] | null | null | null |
test/test_dicti.py
|
rudolfbyker/pydicti
|
fa414fd7f8ba3103f40452b2740144f6f50fee69
|
[
"WTFPL"
] | null | null | null |
import unittest
import test.test_common
from pydicti import build_dicti
class Test_dicti(test.test_common.TestBase):
base = dict
cls = build_dicti(dict)
if __name__ == '__main__':
unittest.main()
| 17.583333
| 44
| 0.744076
| 29
| 211
| 4.965517
| 0.551724
| 0.111111
| 0.194444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.170616
| 211
| 11
| 45
| 19.181818
| 0.822857
| 0
| 0
| 0
| 0
| 0
| 0.037915
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.375
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
b929e0dd1dfba3691aa0552d878dbbfb435df93e
| 33
|
py
|
Python
|
prototype/test/pythonvm_book/b.py
|
zoloypzuo/ZeloPy
|
43d9242a509737fe1bb66deba73aa9e749b53c62
|
[
"MIT"
] | null | null | null |
prototype/test/pythonvm_book/b.py
|
zoloypzuo/ZeloPy
|
43d9242a509737fe1bb66deba73aa9e749b53c62
|
[
"MIT"
] | null | null | null |
prototype/test/pythonvm_book/b.py
|
zoloypzuo/ZeloPy
|
43d9242a509737fe1bb66deba73aa9e749b53c62
|
[
"MIT"
] | null | null | null |
x = 100
def foo():
print x
| 5.5
| 11
| 0.484848
| 6
| 33
| 2.666667
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15
| 0.393939
| 33
| 5
| 12
| 6.6
| 0.65
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.333333
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b94ebe27b4edb4d21ed09ce981a0ab09d3846801
| 18
|
py
|
Python
|
cloudmesh/ssh/__version__.py
|
cloudmesh/cloudmesh-ssh
|
ed10c5524defe99ed782150c4870545df7d3f28b
|
[
"Apache-2.0"
] | null | null | null |
cloudmesh/ssh/__version__.py
|
cloudmesh/cloudmesh-ssh
|
ed10c5524defe99ed782150c4870545df7d3f28b
|
[
"Apache-2.0"
] | null | null | null |
cloudmesh/ssh/__version__.py
|
cloudmesh/cloudmesh-ssh
|
ed10c5524defe99ed782150c4870545df7d3f28b
|
[
"Apache-2.0"
] | 1
|
2020-03-23T03:15:47.000Z
|
2020-03-23T03:15:47.000Z
|
version = "4.3.5"
| 9
| 17
| 0.555556
| 4
| 18
| 2.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| 0.166667
| 18
| 1
| 18
| 18
| 0.466667
| 0
| 0
| 0
| 0
| 0
| 0.277778
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b96be77b050823b350d1e42c1158e56d00b1eba5
| 466
|
py
|
Python
|
client/models.py
|
memoartpad/orders
|
032eed1e881a1faa4d8ca7765a3afec247121649
|
[
"MIT"
] | null | null | null |
client/models.py
|
memoartpad/orders
|
032eed1e881a1faa4d8ca7765a3afec247121649
|
[
"MIT"
] | null | null | null |
client/models.py
|
memoartpad/orders
|
032eed1e881a1faa4d8ca7765a3afec247121649
|
[
"MIT"
] | null | null | null |
from django.db import models
class Client(models.Model):
TYPE_CHOICES = (
("NORMAL", "Normal"),
("PLATA", "Plata"),
("ORO", "Oro"),
("PLATINO", "Platino"),
)
name = models.CharField(max_length=64, blank=False)
code = models.CharField(max_length=64, blank=False)
photo = models.CharField(max_length=128)
address = models.CharField(max_length=128)
type = models.CharField(max_length=7, choices=TYPE_CHOICES, default="NORMAL")
| 29.125
| 81
| 0.669528
| 58
| 466
| 5.258621
| 0.465517
| 0.245902
| 0.295082
| 0.393443
| 0.413115
| 0.236066
| 0.236066
| 0
| 0
| 0
| 0
| 0.028424
| 0.169528
| 466
| 15
| 82
| 31.066667
| 0.75969
| 0
| 0
| 0
| 0
| 0
| 0.103004
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.076923
| 0
| 0.615385
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
b96ff1317a6f79a084fd6801a83c8487f346a685
| 185
|
py
|
Python
|
project_name/todo_api/serializers.py
|
Saknowman/django-rest-vue-template
|
f97139b28aa148609561a1018ea2aef9bd3b4374
|
[
"MIT"
] | null | null | null |
project_name/todo_api/serializers.py
|
Saknowman/django-rest-vue-template
|
f97139b28aa148609561a1018ea2aef9bd3b4374
|
[
"MIT"
] | 9
|
2019-11-02T00:37:12.000Z
|
2022-02-10T13:49:16.000Z
|
project_name/todo_api/serializers.py
|
Saknowman/django-rest-vue-template
|
f97139b28aa148609561a1018ea2aef9bd3b4374
|
[
"MIT"
] | null | null | null |
from rest_framework import serializers
from .models import TodoTask
class TodoTask_Serializer(serializers.ModelSerializer):
class Meta:
model = TodoTask
fields = ('title', )
| 23.125
| 55
| 0.767568
| 20
| 185
| 7
| 0.7
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.162162
| 185
| 7
| 56
| 26.428571
| 0.903226
| 0
| 0
| 0
| 0
| 0
| 0.027027
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
b98cc20695ee390c95942db4ed3daa2c0089e86d
| 22
|
py
|
Python
|
.venv/lib/python3.9/site-packages/isort/_version.py
|
linuscyl/multimedia-computing-assignment
|
4932f531f67a7f57e132ea358bf70a2347021aa9
|
[
"Apache-2.0"
] | null | null | null |
.venv/lib/python3.9/site-packages/isort/_version.py
|
linuscyl/multimedia-computing-assignment
|
4932f531f67a7f57e132ea358bf70a2347021aa9
|
[
"Apache-2.0"
] | 20
|
2021-05-03T18:02:23.000Z
|
2022-03-12T12:01:04.000Z
|
Lib/site-packages/isort/_version.py
|
fochoao/cpython
|
3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9
|
[
"bzip2-1.0.6",
"0BSD"
] | null | null | null |
__version__ = "5.9.1"
| 11
| 21
| 0.636364
| 4
| 22
| 2.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 0.136364
| 22
| 1
| 22
| 22
| 0.368421
| 0
| 0
| 0
| 0
| 0
| 0.227273
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b9b45f2340d7d5ccc216bfeb8471083827648976
| 231
|
py
|
Python
|
task3.py
|
Yeder34/python-tasks
|
2feb23fd97968bf2fae3bd7da59adf4156baa331
|
[
"MIT"
] | null | null | null |
task3.py
|
Yeder34/python-tasks
|
2feb23fd97968bf2fae3bd7da59adf4156baa331
|
[
"MIT"
] | null | null | null |
task3.py
|
Yeder34/python-tasks
|
2feb23fd97968bf2fae3bd7da59adf4156baa331
|
[
"MIT"
] | null | null | null |
def find_longest_word(words_list):
word_len = []
for n in words_list:
word_len.append((len(n), n))
word_len.sort()
return word_len[-1][1]
print(find_longest_word(["PHP", "Exercises", "Backend"]))
| 23.1
| 58
| 0.614719
| 34
| 231
| 3.882353
| 0.529412
| 0.212121
| 0.227273
| 0.242424
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011173
| 0.225108
| 231
| 9
| 59
| 25.666667
| 0.726257
| 0
| 0
| 0
| 0
| 0
| 0.085973
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0
| 0
| 0.285714
| 0.142857
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b9c328c888c3c6c361ae2c21311d59fc8aa6ebb0
| 153
|
py
|
Python
|
python/async/common.py
|
dkandalov/katas
|
1c040f5cbc5fb10c11df3f2738814701f7b777b8
|
[
"Unlicense"
] | 7
|
2015-05-03T16:57:24.000Z
|
2020-07-02T19:35:14.000Z
|
python/async/common.py
|
dkandalov/katas
|
1c040f5cbc5fb10c11df3f2738814701f7b777b8
|
[
"Unlicense"
] | 15
|
2015-10-18T09:09:43.000Z
|
2022-02-01T00:57:47.000Z
|
python/async/common.py
|
dkandalov/katas
|
1c040f5cbc5fb10c11df3f2738814701f7b777b8
|
[
"Unlicense"
] | 3
|
2017-08-17T18:25:46.000Z
|
2021-02-07T10:59:40.000Z
|
def expect_to_be_equal(actual, expected):
if actual != expected:
raise Exception("Expected: " + str(expected) + "\nbut was: " + str(actual))
| 38.25
| 83
| 0.653595
| 19
| 153
| 5.105263
| 0.684211
| 0.28866
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.196078
| 153
| 3
| 84
| 51
| 0.788618
| 0
| 0
| 0
| 0
| 0
| 0.137255
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b9e1d0836f063940302d2c39140c7480f92ea57e
| 8,573
|
py
|
Python
|
release/stubs.min/System/ComponentModel/__init___parts/PropertyDescriptorCollection.py
|
htlcnn/ironpython-stubs
|
780d829e2104b2789d5f4d6f32b0ec9f2930ca03
|
[
"MIT"
] | 182
|
2017-06-27T02:26:15.000Z
|
2022-03-30T18:53:43.000Z
|
release/stubs.min/System/ComponentModel/__init___parts/PropertyDescriptorCollection.py
|
htlcnn/ironpython-stubs
|
780d829e2104b2789d5f4d6f32b0ec9f2930ca03
|
[
"MIT"
] | 28
|
2017-06-27T13:38:23.000Z
|
2022-03-15T11:19:44.000Z
|
release/stubs.min/System/ComponentModel/__init___parts/PropertyDescriptorCollection.py
|
htlcnn/ironpython-stubs
|
780d829e2104b2789d5f4d6f32b0ec9f2930ca03
|
[
"MIT"
] | 67
|
2017-06-28T09:43:59.000Z
|
2022-03-20T21:17:10.000Z
|
class PropertyDescriptorCollection(object,ICollection,IEnumerable,IList,IDictionary):
"""
Represents a collection of System.ComponentModel.PropertyDescriptor objects.
PropertyDescriptorCollection(properties: Array[PropertyDescriptor])
PropertyDescriptorCollection(properties: Array[PropertyDescriptor],readOnly: bool)
"""
def Add(self,value):
"""
Add(self: PropertyDescriptorCollection,value: PropertyDescriptor) -> int
Adds the specified System.ComponentModel.PropertyDescriptor to the collection.
value: The System.ComponentModel.PropertyDescriptor to add to the collection.
Returns: The index of the System.ComponentModel.PropertyDescriptor that was added to the collection.
"""
pass
def Clear(self):
"""
Clear(self: PropertyDescriptorCollection)
Removes all System.ComponentModel.PropertyDescriptor objects from the collection.
"""
pass
def Contains(self,value):
"""
Contains(self: PropertyDescriptorCollection,value: PropertyDescriptor) -> bool
Returns whether the collection contains the given System.ComponentModel.PropertyDescriptor.
value: The System.ComponentModel.PropertyDescriptor to find in the collection.
Returns: true if the collection contains the given System.ComponentModel.PropertyDescriptor; otherwise,
false.
"""
pass
def CopyTo(self,array,index):
"""
CopyTo(self: PropertyDescriptorCollection,array: Array,index: int)
Copies the entire collection to an array,starting at the specified index number.
array: An array of System.ComponentModel.PropertyDescriptor objects to copy elements of the collection
to.
index: The index of the array parameter at which copying begins.
"""
pass
def Find(self,name,ignoreCase):
"""
Find(self: PropertyDescriptorCollection,name: str,ignoreCase: bool) -> PropertyDescriptor
Returns the System.ComponentModel.PropertyDescriptor with the specified name,using a Boolean to
indicate whether to ignore case.
name: The name of the System.ComponentModel.PropertyDescriptor to return from the collection.
ignoreCase: true if you want to ignore the case of the property name; otherwise,false.
Returns: A System.ComponentModel.PropertyDescriptor with the specified name,or null if the property does
not exist.
"""
pass
def GetEnumerator(self):
"""
GetEnumerator(self: PropertyDescriptorCollection) -> IEnumerator
Returns an enumerator for this class.
Returns: An enumerator of type System.Collections.IEnumerator.
"""
pass
def IndexOf(self,value):
"""
IndexOf(self: PropertyDescriptorCollection,value: PropertyDescriptor) -> int
Returns the index of the given System.ComponentModel.PropertyDescriptor.
value: The System.ComponentModel.PropertyDescriptor to return the index of.
Returns: The index of the given System.ComponentModel.PropertyDescriptor.
"""
pass
def Insert(self,index,value):
"""
Insert(self: PropertyDescriptorCollection,index: int,value: PropertyDescriptor)
Adds the System.ComponentModel.PropertyDescriptor to the collection at the specified index
number.
index: The index at which to add the value parameter to the collection.
value: The System.ComponentModel.PropertyDescriptor to add to the collection.
"""
pass
def InternalSort(self,*args):
"""
InternalSort(self: PropertyDescriptorCollection,sorter: IComparer)
Sorts the members of this collection,using the specified System.Collections.IComparer.
sorter: A comparer to use to sort the System.ComponentModel.PropertyDescriptor objects in this
collection.
InternalSort(self: PropertyDescriptorCollection,names: Array[str])
Sorts the members of this collection. The specified order is applied first,followed by the
default sort for this collection,which is usually alphabetical.
names: An array of strings describing the order in which to sort the
System.ComponentModel.PropertyDescriptor objects in this collection.
"""
pass
def Remove(self,value):
"""
Remove(self: PropertyDescriptorCollection,value: PropertyDescriptor)
Removes the specified System.ComponentModel.PropertyDescriptor from the collection.
value: The System.ComponentModel.PropertyDescriptor to remove from the collection.
"""
pass
def RemoveAt(self,index):
"""
RemoveAt(self: PropertyDescriptorCollection,index: int)
Removes the System.ComponentModel.PropertyDescriptor at the specified index from the collection.
index: The index of the System.ComponentModel.PropertyDescriptor to remove from the collection.
"""
pass
def Sort(self,*__args):
"""
Sort(self: PropertyDescriptorCollection,names: Array[str],comparer: IComparer) -> PropertyDescriptorCollection
Sorts the members of this collection. The specified order is applied first,followed by the sort
using the specified System.Collections.IComparer.
names: An array of strings describing the order in which to sort the
System.ComponentModel.PropertyDescriptor objects in this collection.
comparer: A comparer to use to sort the System.ComponentModel.PropertyDescriptor objects in this
collection.
Returns: A new System.ComponentModel.PropertyDescriptorCollection that contains the sorted
System.ComponentModel.PropertyDescriptor objects.
Sort(self: PropertyDescriptorCollection,comparer: IComparer) -> PropertyDescriptorCollection
Sorts the members of this collection,using the specified System.Collections.IComparer.
comparer: A comparer to use to sort the System.ComponentModel.PropertyDescriptor objects in this
collection.
Returns: A new System.ComponentModel.PropertyDescriptorCollection that contains the sorted
System.ComponentModel.PropertyDescriptor objects.
Sort(self: PropertyDescriptorCollection) -> PropertyDescriptorCollection
Sorts the members of this collection,using the default sort for this collection,which is
usually alphabetical.
Returns: A new System.ComponentModel.PropertyDescriptorCollection that contains the sorted
System.ComponentModel.PropertyDescriptor objects.
Sort(self: PropertyDescriptorCollection,names: Array[str]) -> PropertyDescriptorCollection
Sorts the members of this collection. The specified order is applied first,followed by the
default sort for this collection,which is usually alphabetical.
names: An array of strings describing the order in which to sort the
System.ComponentModel.PropertyDescriptor objects in this collection.
Returns: A new System.ComponentModel.PropertyDescriptorCollection that contains the sorted
System.ComponentModel.PropertyDescriptor objects.
"""
pass
def __add__(self,*args):
""" x.__add__(y) <==> x+y """
pass
def __contains__(self,*args):
"""
__contains__(self: IList,value: object) -> bool
Determines whether the System.Collections.IList contains a specific value.
value: The object to locate in the System.Collections.IList.
Returns: true if the System.Object is found in the System.Collections.IList; otherwise,false.
"""
pass
def __getitem__(self,*args):
""" x.__getitem__(y) <==> x[y]x.__getitem__(y) <==> x[y] """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __iter__(self,*args):
""" __iter__(self: IEnumerable) -> object """
pass
def __len__(self,*args):
""" x.__len__() <==> len(x) """
pass
@staticmethod
def __new__(self,properties,readOnly=None):
"""
__new__(cls: type,properties: Array[PropertyDescriptor])
__new__(cls: type,properties: Array[PropertyDescriptor],readOnly: bool)
"""
pass
def __repr__(self,*args):
""" __repr__(self: object) -> str """
pass
Count=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the number of property descriptors in the collection.
Get: Count(self: PropertyDescriptorCollection) -> int
"""
Empty=None
| 25.978788
| 215
| 0.722268
| 932
| 8,573
| 6.530043
| 0.148069
| 0.115018
| 0.193559
| 0.114525
| 0.633914
| 0.534834
| 0.479132
| 0.450049
| 0.432632
| 0.398784
| 0
| 0
| 0.202613
| 8,573
| 329
| 216
| 26.057751
| 0.890287
| 0.786306
| 0
| 0.454545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.454545
| false
| 0.454545
| 0
| 0
| 0.522727
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
b9ea9787d9f89febc4f219bc01e9bc8d67359064
| 648
|
py
|
Python
|
extended_rl/agents/misc_agents.py
|
semitrivial/ExtendedEnvironments
|
1183ff9a03468452db929244c8c7c3e97e392223
|
[
"MIT"
] | null | null | null |
extended_rl/agents/misc_agents.py
|
semitrivial/ExtendedEnvironments
|
1183ff9a03468452db929244c8c7c3e97e392223
|
[
"MIT"
] | 16
|
2021-02-28T22:25:17.000Z
|
2021-10-13T20:15:33.000Z
|
extended_rl/agents/misc_agents.py
|
semitrivial/ExtendedEnvironments
|
1183ff9a03468452db929244c8c7c3e97e392223
|
[
"MIT"
] | 3
|
2021-02-23T00:28:29.000Z
|
2021-11-12T02:47:59.000Z
|
from extended_rl.prerandom import agentrandom
class RandomAgent:
"""
Agent which acts randomly. Pulls random numbers from a pre-generated
store of random numbers to ensure semi-determinacy.
"""
def __init__(self, **kwargs):
self.cnt = 0
def act(self, obs):
return agentrandom.randrange(self.n_actions, self.cnt)
def train(self, o_prev, a, r, o_next):
self.cnt += 1
class ConstantAgent:
"""
Agent which always takes action 0.
"""
def __init__(self, **kwargs):
return
def act(self, obs):
return 0
def train(self, o_prev, a, r, o_next):
return
| 21.6
| 72
| 0.623457
| 87
| 648
| 4.482759
| 0.528736
| 0.053846
| 0.05641
| 0.087179
| 0.220513
| 0.123077
| 0.123077
| 0.123077
| 0.123077
| 0
| 0
| 0.008529
| 0.276235
| 648
| 29
| 73
| 22.344828
| 0.823028
| 0.239198
| 0
| 0.533333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0.066667
| 0.266667
| 0.866667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
6a0f4498021034a7efcbec6f8e32c3d381799ddd
| 481
|
py
|
Python
|
helpers/__init__.py
|
hpagseddy/ZPUI
|
b82819e523987639c2dfab417f9895d7cd7ce049
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
helpers/__init__.py
|
hpagseddy/ZPUI
|
b82819e523987639c2dfab417f9895d7cd7ce049
|
[
"Apache-2.0",
"MIT"
] | 2
|
2020-01-17T00:44:53.000Z
|
2020-01-19T21:10:48.000Z
|
helpers/__init__.py
|
hpagseddy/ZPUI
|
b82819e523987639c2dfab417f9895d7cd7ce049
|
[
"Apache-2.0",
"MIT"
] | 1
|
2020-01-14T22:44:27.000Z
|
2020-01-14T22:44:27.000Z
|
from config_parse import read_config, write_config, read_or_create_config, save_config_gen, save_config_method_gen
from general import local_path_gen, flatten, Singleton
from runners import BooleanEvent, Oneshot, BackgroundRunner
from usability import ExitHelper, remove_left_failsafe
from logger import setup_logger
from process import ProHelper
from input_system import KEY_RELEASED, KEY_HELD, KEY_PRESSED, cb_needs_key_state
from env import zpui_running_as_service, is_emulator
| 53.444444
| 114
| 0.879418
| 72
| 481
| 5.5
| 0.625
| 0.050505
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.093555
| 481
| 8
| 115
| 60.125
| 0.908257
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
dbdedebfa0308ad37a50fbeba1cad3e0c9e43f51
| 912
|
py
|
Python
|
String/8_StringToInteger.py
|
cls1991/leetcode
|
0fd165afa2ec339a6f194bc57f8810e66cd2822b
|
[
"MIT"
] | 180
|
2018-01-25T01:50:04.000Z
|
2021-11-09T11:47:45.000Z
|
String/8_StringToInteger.py
|
cls1991/leetcode
|
0fd165afa2ec339a6f194bc57f8810e66cd2822b
|
[
"MIT"
] | 6
|
2018-01-25T07:51:51.000Z
|
2019-10-26T14:10:53.000Z
|
String/8_StringToInteger.py
|
cls1991/leetcode
|
0fd165afa2ec339a6f194bc57f8810e66cd2822b
|
[
"MIT"
] | 29
|
2018-01-25T01:55:58.000Z
|
2019-09-02T07:19:59.000Z
|
# coding: utf8
"""
题目链接: https://leetcode.com/problems/string-to-integer-atoi/description.
题目描述:
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself
what are the possible input cases.
Notes: It is intended for this problem to be specified vaguely (ie, no given input specs). You are responsible to
gather all the input requirements up front.
Update (2015-02-10):
The signature of the C++ function had been updated. If you still see your function signature accepts a const char *
argument, please click the reload button to reset your code definition.
spoilers alert... click to show requirements for atoi.
"""
class Solution(object):
def myAtoi(self, str):
"""
:type str: str
:rtype: int
"""
pass
| 28.5
| 120
| 0.683114
| 131
| 912
| 4.755725
| 0.725191
| 0.025682
| 0.057785
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0131
| 0.246711
| 912
| 31
| 121
| 29.419355
| 0.893741
| 0.821272
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0.333333
| 0
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
dbec3e8a9037188e35a747323b899ed45dbc3469
| 62
|
py
|
Python
|
j5/backends/hardware/j5/__init__.py
|
trickeydan/j5-dev
|
ba9e2adcb6d9ed766e4be048cb77cf3fa6592b5f
|
[
"MIT"
] | 10
|
2019-01-19T13:09:37.000Z
|
2021-06-18T13:40:10.000Z
|
j5/backends/hardware/j5/__init__.py
|
trickeydan/j5-dev
|
ba9e2adcb6d9ed766e4be048cb77cf3fa6592b5f
|
[
"MIT"
] | 681
|
2019-01-22T18:12:23.000Z
|
2022-03-25T14:14:31.000Z
|
j5/backends/hardware/j5/__init__.py
|
trickeydan/j5-dev
|
ba9e2adcb6d9ed766e4be048cb77cf3fa6592b5f
|
[
"MIT"
] | 8
|
2019-02-22T21:45:47.000Z
|
2021-11-17T19:43:33.000Z
|
"""Abstract hardware backend implementions provided by j5."""
| 31
| 61
| 0.774194
| 7
| 62
| 6.857143
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.018182
| 0.112903
| 62
| 1
| 62
| 62
| 0.854545
| 0.887097
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
e00473f1ca85b88baa122f8fd0eb1a01df22eef7
| 1,265
|
py
|
Python
|
tests/kyu_6_tests/test_matrix_expanding.py
|
the-zebulan/CodeWars
|
1eafd1247d60955a5dfb63e4882e8ce86019f43a
|
[
"MIT"
] | 40
|
2016-03-09T12:26:20.000Z
|
2022-03-23T08:44:51.000Z
|
tests/kyu_6_tests/test_matrix_expanding.py
|
akalynych/CodeWars
|
1eafd1247d60955a5dfb63e4882e8ce86019f43a
|
[
"MIT"
] | null | null | null |
tests/kyu_6_tests/test_matrix_expanding.py
|
akalynych/CodeWars
|
1eafd1247d60955a5dfb63e4882e8ce86019f43a
|
[
"MIT"
] | 36
|
2016-11-07T19:59:58.000Z
|
2022-03-31T11:18:27.000Z
|
import unittest
from katas.kyu_6.matrix_expanding import expand
class MatrixExpandingTestCase(unittest.TestCase):
def test_equal_1(self):
self.assertEqual(expand([[1, 1], [1, 1]], 0),
[[0, 0, 0, 0],
[0, 1, 1, 0],
[0, 1, 1, 0],
[0, 0, 0, 0]])
def test_equal_2(self):
self.assertEqual(expand([[1, 1], [1, 1]], 'a'),
[['a', 'a', 'a', 'a'],
['a', 1, 1, 'a'],
['a', 1, 1, 'a'],
['a', 'a', 'a', 'a']])
def test_equal_3(self):
self.assertEqual(expand([
[1, 2, 3, 4], [5, 6, 7, 8], [9, 0, 1, 2], [3, 4, 5, 6]
], 'HI'), [['HI', 'HI', 'HI', 'HI', 'HI', 'HI', 'HI', 'HI'],
['HI', 'HI', 'HI', 'HI', 'HI', 'HI', 'HI', 'HI'],
['HI', 'HI', 1, 2, 3, 4, 'HI', 'HI'],
['HI', 'HI', 5, 6, 7, 8, 'HI', 'HI'],
['HI', 'HI', 9, 0, 1, 2, 'HI', 'HI'],
['HI', 'HI', 3, 4, 5, 6, 'HI', 'HI'],
['HI', 'HI', 'HI', 'HI', 'HI', 'HI', 'HI', 'HI'],
['HI', 'HI', 'HI', 'HI', 'HI', 'HI', 'HI', 'HI']])
| 39.53125
| 69
| 0.309881
| 161
| 1,265
| 2.385093
| 0.173913
| 0.458333
| 0.609375
| 0.708333
| 0.539063
| 0.473958
| 0.427083
| 0.364583
| 0.213542
| 0.213542
| 0
| 0.089532
| 0.426087
| 1,265
| 31
| 70
| 40.806452
| 0.439394
| 0
| 0
| 0.230769
| 0
| 0
| 0.087747
| 0
| 0
| 0
| 0
| 0
| 0.115385
| 1
| 0.115385
| false
| 0
| 0.076923
| 0
| 0.230769
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
e00ba22f75c288ced87ea1a33f492d70ba22faa3
| 139
|
py
|
Python
|
src/harvesters/__init__.py
|
jcormier/harvesters
|
81ec7aad4799e4432f7bd474b9215d248b7e1be5
|
[
"Apache-2.0"
] | null | null | null |
src/harvesters/__init__.py
|
jcormier/harvesters
|
81ec7aad4799e4432f7bd474b9215d248b7e1be5
|
[
"Apache-2.0"
] | null | null | null |
src/harvesters/__init__.py
|
jcormier/harvesters
|
81ec7aad4799e4432f7bd474b9215d248b7e1be5
|
[
"Apache-2.0"
] | null | null | null |
from ._version import get_versions
__version__ = get_versions()['version']
if not __version__:
__version__ = '1.1.0'
del get_versions
| 19.857143
| 39
| 0.755396
| 19
| 139
| 4.684211
| 0.526316
| 0.370787
| 0.404494
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02521
| 0.143885
| 139
| 6
| 40
| 23.166667
| 0.722689
| 0
| 0
| 0
| 0
| 0
| 0.086957
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 0
| 0.2
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
e00ed92f2db69490c4b8ea69efec8294aded4567
| 126
|
py
|
Python
|
inference-engine/ie_bridges/python/src/openvino/inference_engine/__init__.py
|
evgenytalanin-intel/openvino
|
c3aa866a3318fe9fa8c7ebd3bd333b075bb1cc36
|
[
"Apache-2.0"
] | null | null | null |
inference-engine/ie_bridges/python/src/openvino/inference_engine/__init__.py
|
evgenytalanin-intel/openvino
|
c3aa866a3318fe9fa8c7ebd3bd333b075bb1cc36
|
[
"Apache-2.0"
] | 1
|
2021-09-09T08:43:57.000Z
|
2021-09-10T12:39:16.000Z
|
inference-engine/ie_bridges/python/src/openvino/inference_engine/__init__.py
|
evgenytalanin-intel/openvino
|
c3aa866a3318fe9fa8c7ebd3bd333b075bb1cc36
|
[
"Apache-2.0"
] | null | null | null |
from .ie_api import *
__all__ = ['IENetwork', "IETensorDesc", "IECore", "IEBlob", "get_version"]
__version__ = get_version()
| 25.2
| 74
| 0.706349
| 14
| 126
| 5.571429
| 0.785714
| 0.25641
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119048
| 126
| 4
| 75
| 31.5
| 0.702703
| 0
| 0
| 0
| 0
| 0
| 0.352
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
e01932064c17aaadff74b992df421d9d366e6504
| 84
|
py
|
Python
|
cubs/apps.py
|
kiza054/woodhall-website
|
73a27e93da818bff2c3efbea3409cf63356a4d32
|
[
"MIT"
] | 2
|
2021-02-01T13:50:51.000Z
|
2022-02-03T19:30:16.000Z
|
cubs/apps.py
|
kiza054/woodhall-website
|
73a27e93da818bff2c3efbea3409cf63356a4d32
|
[
"MIT"
] | null | null | null |
cubs/apps.py
|
kiza054/woodhall-website
|
73a27e93da818bff2c3efbea3409cf63356a4d32
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class CubsConfig(AppConfig):
name = 'cubs'
| 21
| 34
| 0.72619
| 10
| 84
| 6.1
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.190476
| 84
| 4
| 35
| 21
| 0.897059
| 0
| 0
| 0
| 0
| 0
| 0.04878
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
e03ebd76d9d486c736e466e4fbaf813d193383fe
| 466
|
py
|
Python
|
bugtests/test186a.py
|
doom38/jython_v2.2.1
|
0803a0c953c294e6d14f9fc7d08edf6a3e630a15
|
[
"CNRI-Jython"
] | null | null | null |
bugtests/test186a.py
|
doom38/jython_v2.2.1
|
0803a0c953c294e6d14f9fc7d08edf6a3e630a15
|
[
"CNRI-Jython"
] | null | null | null |
bugtests/test186a.py
|
doom38/jython_v2.2.1
|
0803a0c953c294e6d14f9fc7d08edf6a3e630a15
|
[
"CNRI-Jython"
] | null | null | null |
import java
# Define a Python class that subclasses the Applet class
# (java.applet.Applet)
class test186a (java.applet.Applet):
def __init__(self):
self.list = java.awt.List()
self.add(self.list)
def init(self):
self.list.add("Init called")
def destroy(self):
self.list.add("Destroy called")
def start(self):
self.list.add("Start called")
def stop(self):
self.list.add("Stop called")
| 25.888889
| 56
| 0.613734
| 63
| 466
| 4.47619
| 0.333333
| 0.170213
| 0.212766
| 0.212766
| 0.134752
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008671
| 0.257511
| 466
| 17
| 57
| 27.411765
| 0.806358
| 0.160944
| 0
| 0
| 0
| 0
| 0.123711
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.384615
| false
| 0
| 0.076923
| 0
| 0.538462
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
e06264339e0e928db4d8230f26c91974122b3fce
| 92
|
py
|
Python
|
sghymnal/foes/apps.py
|
shortnd/sghymnal
|
c10d9a7e2fda803dcb5046b9f7bc099f32b6c603
|
[
"MIT"
] | null | null | null |
sghymnal/foes/apps.py
|
shortnd/sghymnal
|
c10d9a7e2fda803dcb5046b9f7bc099f32b6c603
|
[
"MIT"
] | null | null | null |
sghymnal/foes/apps.py
|
shortnd/sghymnal
|
c10d9a7e2fda803dcb5046b9f7bc099f32b6c603
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class FoesConfig(AppConfig):
name = "sghymnal.foes"
| 15.333333
| 33
| 0.75
| 11
| 92
| 6.272727
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.163043
| 92
| 5
| 34
| 18.4
| 0.896104
| 0
| 0
| 0
| 0
| 0
| 0.141304
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
e06e3c1e2ea68ad23b9d4f02a6bc06b5dac12107
| 527
|
py
|
Python
|
01-DesenvolvimentoDeSistemas/02-LinguagensDeProgramacao/01-Python/01-ListaDeExercicios/02-Aluno/Ariston/exc0015.py
|
moacirsouza/nadas
|
ad98d73b4281d1581fd2b2a9d29001acb426ee56
|
[
"MIT"
] | 1
|
2020-07-03T13:54:18.000Z
|
2020-07-03T13:54:18.000Z
|
01-DesenvolvimentoDeSistemas/02-LinguagensDeProgramacao/01-Python/01-ListaDeExercicios/02-Aluno/Ariston/exc0015.py
|
moacirsouza/nadas
|
ad98d73b4281d1581fd2b2a9d29001acb426ee56
|
[
"MIT"
] | null | null | null |
01-DesenvolvimentoDeSistemas/02-LinguagensDeProgramacao/01-Python/01-ListaDeExercicios/02-Aluno/Ariston/exc0015.py
|
moacirsouza/nadas
|
ad98d73b4281d1581fd2b2a9d29001acb426ee56
|
[
"MIT"
] | null | null | null |
print('Escreva um programa que pergunte a quantidade de Km percorridos por um carro alugado e a quantidade de dias pelos quais ele foi alugado.')
print(' Calcule o preço a pagar, sabendo que o carro custa R$60 por dia e R$0.15 por Km rodado.\n')
quilometro = int(input('Quantos quilometros o carro andou: '))
dias = int(input('Por quantos dias o carro foi alugado: '))
pagar = (dias*60)+(quilometro*0.15)
print('Apos ficar com o carro {} dias e ter percorrido {} Km, você só vai pagar R$ {:.2f}.'.format(dias,quilometro,pagar))
| 87.833333
| 145
| 0.732448
| 93
| 527
| 4.150538
| 0.526882
| 0.062176
| 0.067358
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.024664
| 0.1537
| 527
| 6
| 146
| 87.833333
| 0.840807
| 0
| 0
| 0
| 0
| 0.5
| 0.723485
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
0eb2186e58f85756fac36fbbb9b05c5395ededfa
| 74
|
py
|
Python
|
example/setup.py
|
obestwalter/tox-virtualenv-no-download
|
0689c0bc5c2488de027e4ddc86694e9002063a67
|
[
"MIT"
] | 20
|
2017-04-29T23:00:26.000Z
|
2019-05-01T00:34:50.000Z
|
example/setup.py
|
obestwalter/tox-virtualenv-no-download
|
0689c0bc5c2488de027e4ddc86694e9002063a67
|
[
"MIT"
] | 4
|
2018-02-01T00:09:54.000Z
|
2019-05-17T17:04:42.000Z
|
example/setup.py
|
asottile-archive/tox-virtualenv-no-download
|
99bd544294f6b691ad83805f2a110a8ca27ab72c
|
[
"MIT"
] | 3
|
2017-09-14T20:54:04.000Z
|
2019-01-09T14:43:58.000Z
|
from setuptools import setup
setup(name='example-project-please-ignore')
| 18.5
| 43
| 0.810811
| 10
| 74
| 6
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.081081
| 74
| 3
| 44
| 24.666667
| 0.882353
| 0
| 0
| 0
| 0
| 0
| 0.391892
| 0.391892
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
0eb6734f7adb4aee621e1521eae16576b1fa299e
| 271
|
py
|
Python
|
BookPassDesign/tests/world.py
|
asteroidDavis/BookPass
|
f4ecf3196073b7360f0af26dc3e0f377c3646529
|
[
"MIT"
] | null | null | null |
BookPassDesign/tests/world.py
|
asteroidDavis/BookPass
|
f4ecf3196073b7360f0af26dc3e0f377c3646529
|
[
"MIT"
] | null | null | null |
BookPassDesign/tests/world.py
|
asteroidDavis/BookPass
|
f4ecf3196073b7360f0af26dc3e0f377c3646529
|
[
"MIT"
] | null | null | null |
from BookPassDesign.classes import Book
'''
a_long_book() - return an object of the book class with hundreds of pages and fields
'''
#todo: finish this then finish the rest of entries in tests\Page.py
def a_long_book():
long_book = Book.Book()
return long_book
| 24.636364
| 84
| 0.741697
| 45
| 271
| 4.333333
| 0.644444
| 0.164103
| 0.092308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.180812
| 271
| 10
| 85
| 27.1
| 0.878378
| 0.243542
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 0
| 1
| 0.25
| false
| 0.25
| 0.25
| 0
| 0.75
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
0ed039f4fa62e828f1aa468865ddfbb747d2d37a
| 85
|
py
|
Python
|
drf_nested_forms/exceptions.py
|
emperorDuke/nested_formdata
|
f6850b5a3836dbc4af9a7d1104981f2198cc1a30
|
[
"MIT"
] | 12
|
2020-03-30T05:41:37.000Z
|
2022-02-08T17:52:14.000Z
|
drf_nested_forms/exceptions.py
|
emperorDuke/nested_formdata
|
f6850b5a3836dbc4af9a7d1104981f2198cc1a30
|
[
"MIT"
] | 6
|
2020-03-28T21:39:49.000Z
|
2021-11-24T21:37:27.000Z
|
drf_nested_forms/exceptions.py
|
emperorDuke/nested_formdata
|
f6850b5a3836dbc4af9a7d1104981f2198cc1a30
|
[
"MIT"
] | 2
|
2021-05-14T17:36:42.000Z
|
2021-06-06T19:33:04.000Z
|
class ParseError(Exception):
"""
Unable to parse data type
"""
pass
| 12.142857
| 29
| 0.576471
| 9
| 85
| 5.444444
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.317647
| 85
| 6
| 30
| 14.166667
| 0.844828
| 0.294118
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.